Adds a logging level command line switch
- Adds --log-level=n with n=0,1,2,3
- Increases the default logging level from INFO to WARNING there is way too much noise there.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1547 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
index 2fed631..232e500 100644
--- a/chrome/common/logging_chrome.cc
+++ b/chrome/common/logging_chrome.cc
@@ -104,6 +104,17 @@
command_line.GetSwitchValue(switches::kLogFilterPrefix);
logging::SetLogFilterPrefix(WideToUTF8(log_filter_prefix).c_str());
+ // Use a minimum log level if the command line has one, otherwise set the
+ // default to LOG_WARNING.
+ std::wstring log_level = command_line.GetSwitchValue(switches::kLoggingLevel);
+ int level = 0;
+ if (StringToInt(log_level, &level)) {
+ if ((level >= 0) && (level < LOG_NUM_SEVERITIES))
+ logging::SetMinLogLevel(level);
+ } else {
+ logging::SetMinLogLevel(LOG_WARNING);
+ }
+
chrome_logging_initialized_ = true;
}