From a8a558c66d9b1dcbd7db2b54c02fd07eb86c8c62 Mon Sep 17 00:00:00 2001 From: Sandboxed API Team Date: Wed, 8 Jun 2022 04:52:24 -0700 Subject: [PATCH] Fix SAPI_VLOG_LEVEL handling so that VLOGs at level <= the specified level are printed. PiperOrigin-RevId: 453652875 Change-Id: Ibd0f2c54a0e5c6bab7e65633b5b5680dbe36f5ae --- sandboxed_api/util/raw_logging.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sandboxed_api/util/raw_logging.cc b/sandboxed_api/util/raw_logging.cc index 3e91fcc..dd10a07 100644 --- a/sandboxed_api/util/raw_logging.cc +++ b/sandboxed_api/util/raw_logging.cc @@ -149,7 +149,7 @@ void SafeWriteToStderr(const char* s, size_t len) { bool VLogIsOn(int verbose_level) { static int external_verbose_level = [] { - int external_verbose_level = std::numeric_limits::max(); + int external_verbose_level = std::numeric_limits::min(); char* env_var = getenv("SAPI_VLOG_LEVEL"); if (!env_var) { return external_verbose_level; @@ -159,7 +159,7 @@ bool VLogIsOn(int verbose_level) { "SAPI_VLOG_LEVEL needs to be an integer >= 0"); return external_verbose_level; }(); - return verbose_level >= external_verbose_level; + return verbose_level <= external_verbose_level; } } // namespace sapi::raw_logging_internal