Commit 66dbc95a authored by Michael Giuffrida's avatar Michael Giuffrida Committed by Commit Bot

Add --log-file=PATH switch to app_shell

Let users specify the logging location. The switch name is intentionally
left generic to allow other binaries to use the same flag.

Bug: 760431
Change-Id: I5f03f146b090fa5ba0e21718aeb27f5780981dde
Reviewed-on: https://chromium-review.googlesource.com/647314Reviewed-by: default avatarNick Carter <nick@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503645}
parent d4c912f9
......@@ -637,6 +637,11 @@ const char kLogGpuControlListDecisions[] = "log-gpu-control-list-decisions";
// INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.
const char kLoggingLevel[] = "log-level";
// Overrides the default file name to use for general-purpose logging (does not
// affect which events are logged). Currently supported only in app_shell.
// TODO(crbug.com/760431): Make this work in chrome and content_shell too.
const char kLogFile[] = "log-file";
// Enables saving net log events to a file and sets the file name to use.
const char kLogNetLog[] = "log-net-log";
......
......@@ -189,6 +189,7 @@ CONTENT_EXPORT extern const char kJavaScriptFlags[];
CONTENT_EXPORT extern const char kJavaScriptHarmony[];
CONTENT_EXPORT extern const char kLogGpuControlListDecisions[];
CONTENT_EXPORT extern const char kLoggingLevel[];
CONTENT_EXPORT extern const char kLogFile[];
CONTENT_EXPORT extern const char kLogNetLog[];
CONTENT_EXPORT extern const char kMainFrameResizesAreOrientationChanges[];
extern const char kMaxUntiledLayerHeight[];
......
......@@ -79,8 +79,13 @@ base::FilePath GetDataPath() {
}
void InitLogging() {
const base::FilePath log_path =
GetDataPath().Append(FILE_PATH_LITERAL("app_shell.log"));
base::FilePath log_path;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLogFile)) {
log_path = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kLogFile);
} else {
log_path = GetDataPath().Append(FILE_PATH_LITERAL("app_shell.log"));
}
// Set up log initialization settings.
logging::LoggingSettings settings;
......
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