diff options
author | skobes <skobes@chromium.org> | 2015-12-07 12:21:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-07 20:22:13 +0000 |
commit | c78c0ad7cca1b37761b488e9499d619b21c8016d (patch) | |
tree | 1e14a075d915fd00178a5923d9c6416cd238b4cb /base/logging.cc | |
parent | 09b359e586c35cf06a985dcf326a31aea4a1c6db (diff) | |
download | chromium_src-c78c0ad7cca1b37761b488e9499d619b21c8016d.zip chromium_src-c78c0ad7cca1b37761b488e9499d619b21c8016d.tar.gz chromium_src-c78c0ad7cca1b37761b488e9499d619b21c8016d.tar.bz2 |
Don't evaluate args to LOG(INFO) and LOG(WARNING) in release builds.
We were using the LAZY_STREAM macro to do this based on --log-level (which
defaults to INFO), but not for LoggingSettings::logging_dest == LOG_NONE.
Review URL: https://codereview.chromium.org/1499693002
Cr-Commit-Position: refs/heads/master@{#363565}
Diffstat (limited to 'base/logging.cc')
-rw-r--r-- | base/logging.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/base/logging.cc b/base/logging.cc index 650351d..20bc7f5 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -390,6 +390,17 @@ int GetMinLogLevel() { return g_min_log_level; } +bool ShouldCreateLogMessage(int severity) { + if (severity < g_min_log_level) + return false; + + // Return true here unless we know ~LogMessage won't do anything. Note that + // ~LogMessage writes to stderr if severity_ >= kAlwaysPrintErrorLevel, even + // when g_logging_destination is LOG_NONE. + return g_logging_destination != LOG_NONE || log_message_handler || + severity >= kAlwaysPrintErrorLevel; +} + int GetVlogVerbosity() { return std::max(-1, LOG_INFO - GetMinLogLevel()); } |