Commit 25922045 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Make lacros log to file if there's a custom lacros path.

If there's a custom lacros path, then this is probably a developer build
and they probably want logging enabled. Logs are dumped in the lacros
user-data-dir with name lacros.log.

Change-Id: I9d23bcc3ed145e5e0cf9a11c3e1bd6c6b26332ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211126
Commit-Queue: Erik Chen <erikchen@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771274}
parent 502dd319
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "chrome/browser/chromeos/lacros/lacros_util.h" #include "chrome/browser/chromeos/lacros/lacros_util.h"
...@@ -141,6 +142,18 @@ void LacrosLoader::Start() { ...@@ -141,6 +142,18 @@ void LacrosLoader::Start() {
"--enable-oop-rasterization", "--enable-oop-rasterization",
"--lang=en-US", "--lang=en-US",
"--breakpad-dump-location=/tmp"}; "--breakpad-dump-location=/tmp"};
// We assume that if there's a custom chrome path, that this is a developer
// and they want to enable logging.
bool custom_chrome_path = base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kLacrosChromePath);
if (custom_chrome_path) {
argv.push_back("--enable-logging");
int64_t seconds = base::Time::Now().ToDeltaSinceWindowsEpoch().InSeconds();
argv.push_back(std::string("--log-file=") + kUserDataDir + "/lacros_" +
base::NumberToString(seconds) + ".log");
}
lacros_process_ = base::LaunchProcess(argv, options); lacros_process_ = base::LaunchProcess(argv, options);
LOG(WARNING) << "Launched lacros-chrome with pid " << lacros_process_.Pid(); LOG(WARNING) << "Launched lacros-chrome with pid " << lacros_process_.Pid();
} }
......
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