Commit 213d59a2 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[common] Warn for invalid --enable-logging values

--enable-logging practically only supports stderr or the empty string
as values. Print a warning if any other value is used.

Change-Id: If854af4a910794f72fd1f246a4e039306153c5a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106587
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755317}
parent 603862c5
......@@ -141,18 +141,20 @@ LoggingDestination DetermineLoggingDestination(
if (command_line.HasSwitch(kInvertLoggingSwitch))
enable_logging = !enable_logging;
LoggingDestination log_mode;
if (enable_logging) {
if (!enable_logging)
return LOG_NONE;
if (command_line.HasSwitch(switches::kEnableLogging)) {
// Let --enable-logging=stderr force only stderr, particularly useful for
// non-debug builds where otherwise you can't get logs to stderr at all.
if (command_line.GetSwitchValueASCII(switches::kEnableLogging) == "stderr")
log_mode = LOG_TO_SYSTEM_DEBUG_LOG | LOG_TO_STDERR;
else
log_mode = kDefaultLoggingMode;
} else {
log_mode = LOG_NONE;
std::string logging_destination =
command_line.GetSwitchValueASCII(switches::kEnableLogging);
if (logging_destination == "stderr") {
return LOG_TO_SYSTEM_DEBUG_LOG | LOG_TO_STDERR;
} else if (logging_destination != "") {
PLOG(ERROR) << "Invalid logging destination: " << logging_destination;
}
}
return log_mode;
return kDefaultLoggingMode;
}
#if defined(OS_CHROMEOS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment