diff options
Diffstat (limited to 'tensorflow/core/platform/default/logging.h')
-rw-r--r-- | tensorflow/core/platform/default/logging.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tensorflow/core/platform/default/logging.h b/tensorflow/core/platform/default/logging.h index 961fb8b4ad..04ff9e12b6 100644 --- a/tensorflow/core/platform/default/logging.h +++ b/tensorflow/core/platform/default/logging.h @@ -41,6 +41,11 @@ class LogMessage : public std::basic_ostringstream<char> { LogMessage(const char* fname, int line, int severity); ~LogMessage(); + // Returns the minimum log level for VLOG statements. + // E.g., if MinVLogLevel() is 2, then VLOG(2) statements will produce output, + // but VLOG(3) will not. Defaults to 0. + static int64 MinVLogLevel(); + protected: void GenerateLogMessage(); @@ -71,11 +76,18 @@ class LogMessageFatal : public LogMessage { #define LOG(severity) _TF_LOG_##severity -// TODO(jeff): Define a proper implementation of VLOG_IS_ON +#ifdef IS_MOBILE_PLATFORM +// Turn VLOG off when under mobile devices for considerations of binary size. #define VLOG_IS_ON(lvl) ((lvl) <= 0) +#else +// Otherwise, Set TF_CPP_MIN_VLOG_LEVEL environment to update minimum log level +// of VLOG +#define VLOG_IS_ON(lvl) \ + ((lvl) <= ::tensorflow::internal::LogMessage::MinVLogLevel()) +#endif #define VLOG(lvl) \ - if (VLOG_IS_ON(lvl)) \ + if (TF_PREDICT_FALSE(VLOG_IS_ON(lvl))) \ ::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::INFO) // CHECK dies with a fatal error if condition is not true. It is *not* |