Fix SAPI_VLOG_LEVEL handling so that VLOGs at level <= the specified level are printed.

PiperOrigin-RevId: 453652875
Change-Id: Ibd0f2c54a0e5c6bab7e65633b5b5680dbe36f5ae
This commit is contained in:
Sandboxed API Team 2022-06-08 04:52:24 -07:00 committed by Copybara-Service
parent eef4707cd1
commit a8a558c66d

View File

@ -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<int>::max();
int external_verbose_level = std::numeric_limits<int>::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