Skip to content

Commit

Permalink
Merge pull request #1472 from hzeller/20220919-prepare-for-vlog-exist…
Browse files Browse the repository at this point in the history
…ence

Prepare VLOG macros to exist at some point.
  • Loading branch information
hzeller authored Sep 20, 2022
2 parents ca1bd9c + 4db71fe commit 8603c22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/util/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ cc_library(
srcs = ["logging.cc"],
hdrs = ["logging.h"],
deps = [
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/log:die_if_null",
],
Expand Down
10 changes: 6 additions & 4 deletions common/util/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@
#include "absl/log/die_if_null.h"
#include "absl/log/log.h"

// There is no vlog yet, so very simple work-around here until it shows up
#ifndef VLOG
namespace verible {
// Used in the VLOG macro to check logging condition. This value is set in
// InitCommandLine() from VERIBLE_VLOG_DETAIL environment variable.
extern int global_vlog_level_;
} // namespace verible

// There is no vlog yet, so very simple work-around here.
#ifndef VLOG_IS_ON
#define VLOG_IS_ON(x) (::verible::global_vlog_level_ >= (x))
#endif
#define VLOG(x) LOG_IF(INFO, VLOG_IS_ON(x))

#ifdef NDEBUG
#define DVLOG(x) LOG_IF(INFO, false)
#else
#define DVLOG(x) VLOG(x)
#endif
#endif // NDEBUG

#endif // VLOG

#define CHECK_NOTNULL(p) (void)ABSL_DIE_IF_NULL(p)

Expand Down

0 comments on commit 8603c22

Please sign in to comment.