summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 19:51:06 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 19:51:06 +0000
commitbb5185c5f46fc6f37b4c89cdbaef77f967020855 (patch)
tree00ea61cf039fb6e3ce952096277e4eaf2b75d388
parent6956cd63fd86015d328a3dfb669a68f34c5e21fa (diff)
downloadchromium_src-bb5185c5f46fc6f37b4c89cdbaef77f967020855.zip
chromium_src-bb5185c5f46fc6f37b4c89cdbaef77f967020855.tar.gz
chromium_src-bb5185c5f46fc6f37b4c89cdbaef77f967020855.tar.bz2
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
-rw-r--r--chrome/browser/plugin_process_host.cc1
-rw-r--r--chrome/browser/render_process_host.cc1
-rw-r--r--chrome/common/chrome_switches.cc12
-rw-r--r--chrome/common/chrome_switches.h3
-rw-r--r--chrome/common/logging_chrome.cc11
5 files changed, 24 insertions, 4 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 90e8db4..58bdc53 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -347,6 +347,7 @@ bool PluginProcessHost::Init(const std::wstring& dll,
switches::kFullMemoryCrashReport,
switches::kEnableLogging,
switches::kDisableLogging,
+ switches::kLoggingLevel,
switches::kUserDataDir,
switches::kAllowAllActiveX,
switches::kEnableDCHECK,
diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc
index c18b4f3..c49e7fd 100644
--- a/chrome/browser/render_process_host.cc
+++ b/chrome/browser/render_process_host.cc
@@ -256,6 +256,7 @@ bool RenderProcessHost::Init() {
switches::kEnableLogging,
switches::kDumpHistogramsOnExit,
switches::kDisableLogging,
+ switches::kLoggingLevel,
switches::kDebugPrint,
switches::kAllowAllActiveX,
switches::kMemoryProfiling,
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index d83dfa0..8b07a37 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -158,15 +158,19 @@ const wchar_t kLogFilterPrefix[] = L"log-filter-prefix";
// builds.
const wchar_t kEnableLogging[] = L"enable-logging";
+// Force logging to be disabled. Logging is enabled by default in debug
+// builds.
+const wchar_t kDisableLogging[] = L"disable-logging";
+
+// Sets the minimum log level. Valid values are from 0 to 3:
+// INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.
+const wchar_t kLoggingLevel[] = L"log-level";
+
// Dump any accumualted histograms to the log when browser terminates (requires
// logging to be enabled to really do anything). Used by developers and test
// scripts.
const wchar_t kDumpHistogramsOnExit[] = L"dump-histograms-on-exit";
-// Force logging to be disabled. Logging is enabled by default in debug
-// builds.
-const wchar_t kDisableLogging[] = L"disable-logging";
-
// enable remote debug / automation shell on the specified port
const wchar_t kRemoteShellPort[] = L"remote-shell-port";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index b76c17b..4ec96f4 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -48,8 +48,11 @@ extern const wchar_t kGeoID[];
extern const wchar_t kLang[];
extern const wchar_t kDebugChildren[];
extern const wchar_t kWaitForDebuggerChildren[];
+
extern const wchar_t kLogFilterPrefix[];
extern const wchar_t kEnableLogging[];
+extern const wchar_t kLoggingLevel[];
+
extern const wchar_t kDumpHistogramsOnExit[];
extern const wchar_t kDisableLogging[];
extern const wchar_t kRemoteShellPort[];
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 @@ void InitChromeLogging(const CommandLine& command_line,
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;
}