diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2014-09-09 11:04:49 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2014-09-11 11:30:46 +0200 |
commit | 2b8b78d04a722b28a103ed1c6a63550c3e45244d (patch) | |
tree | d78f5288607d46410e35defb3b5d88cf3fc66e68 | |
parent | 263e54e5e777a7c45f11560398ae80161327b866 (diff) |
Add --log-level switch
The --log-level switch sets the log level of the chromium messages. It affects
the browser and web processes but has no impact on the Qt messages.
The following levels can be set:
0 -> LOG_INFO
1 -> LOG_WARNING
2 -> LOG_ERROR
3 -> LOG_FATAL
Log level 3 set per default (fatal messages are shown only) since
lower level messages might be irrelevant for those who use QtWebEngine API.
Change-Id: Ie2ba10718d3c86bbfe3d847471b3facb346be446
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 10ee4fcda..e41888976 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -36,8 +36,12 @@ #include "content_main_delegate_qt.h" +#include "base/command_line.h" +#include "base/logging.h" #include "base/path_service.h" +#include "base/strings/string_number_conversions.h" #include "content/public/common/content_paths.h" +#include "content/public/common/content_switches.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_paths.h" #include "ui/base/resource/resource_bundle.h" @@ -60,6 +64,19 @@ void ContentMainDelegateQt::PreSandboxStartup() { net::NetModule::SetResourceProvider(PlatformResourceProvider); ui::ResourceBundle::InitSharedInstanceWithLocale(l10n_util::GetApplicationLocale(std::string("en-US")), 0); + + // Suppress info, warning and error messages per default. + int logLevel = logging::LOG_FATAL; + + CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess(); + if (parsedCommandLine->HasSwitch(switches::kLoggingLevel)) { + std::string logLevelValue = parsedCommandLine->GetSwitchValueASCII(switches::kLoggingLevel); + int level = 0; + if (base::StringToInt(logLevelValue, &level) && level >= logging::LOG_INFO && level < logging::LOG_NUM_SEVERITIES) + logLevel = level; + } + + logging::SetMinLogLevel(logLevel); } content::ContentBrowserClient *ContentMainDelegateQt::CreateContentBrowserClient() |