From bc64d8cc9b88fcd6803a5e6ebe61349146638475 Mon Sep 17 00:00:00 2001 From: "lperron@google.com" Date: Thu, 8 Dec 2011 16:48:29 +0000 Subject: [PATCH] implement VLOG(x) --- base/logging.cc | 2 ++ base/logging.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/logging.cc b/base/logging.cc index bd0255d2cb..a2e18177c4 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -16,6 +16,8 @@ #include "base/logging.h" +DEFINE_int32(log_level, 0, "Log level (0 is the default)."); + namespace operations_research { DateLogger::DateLogger() { #if defined(_MSC_VER) diff --git a/base/logging.h b/base/logging.h index 39909df05e..b7044261fb 100644 --- a/base/logging.h +++ b/base/logging.h @@ -17,8 +17,11 @@ #include #include #include // NOLINT +#include "base/commandlineflags.h" #include "base/macros.h" +DECLARE_int32(log_level); + // Debug-only checking. #define DCHECK(condition) assert(condition) #define DCHECK_EQ(val1, val2) assert((val1) == (val2)) @@ -45,7 +48,7 @@ #define LOG_FATAL LogMessageFatal(__FILE__, __LINE__) #define LOG_QFATAL LOG_FATAL -#define VLOG(x) if ((x) <= 0) LOG_INFO.stream() +#define VLOG(x) if ((x) <= FLAGS_log_level) LOG_INFO.stream() #ifdef NDEBUG #define DEBUG_MODE 0