From be87f0a0f30d19fa6c1543e77497868222d067c5 Mon Sep 17 00:00:00 2001 From: Byoungchan Lee Date: Thu, 16 Dec 2021 17:11:03 +0900 Subject: [PATCH] Clarify about static variables in logging.cc. Bug: None Change-Id: Ia6c751485b5b0a88ce34106a2159fe8af52fc41c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237321 Reviewed-by: Mirko Bonadei Commit-Queue: (Daniel.L) Byoungchan Lee Cr-Commit-Position: refs/heads/main@{#35554} --- rtc_base/logging.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc index 4ebeebebf7..2b5c80b33c 100644 --- a/rtc_base/logging.cc +++ b/rtc_base/logging.cc @@ -55,13 +55,15 @@ namespace rtc { namespace { // By default, release builds don't log, debug builds at info level #if !defined(NDEBUG) -static LoggingSeverity g_min_sev = LS_INFO; -static LoggingSeverity g_dbg_sev = LS_INFO; +constexpr LoggingSeverity kDefaultLoggingSeverity = LS_INFO; #else -static LoggingSeverity g_min_sev = LS_NONE; -static LoggingSeverity g_dbg_sev = LS_NONE; +constexpr LoggingSeverity kDefaultLoggingSeverity = LS_NONE; #endif +// Note: `g_min_sev` and `g_dbg_sev` can be changed while running. +LoggingSeverity g_min_sev = kDefaultLoggingSeverity; +LoggingSeverity g_dbg_sev = kDefaultLoggingSeverity; + // Return the filename portion of the string (that following the last slash). const char* FilenameFromPath(const char* file) { const char* end1 = ::strrchr(file, '/');