Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 2736883002: Use CHROME_LOG_FILE environment variable for headless chrome logging (Closed)
Patch Set: Fix nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_content_main_delegate.cc
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc
index 72df5a29a65a3adaa86b5a24e36bdc028f8dce92..3c9bd168466ac2da0665caa11df114be23a411ed 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -6,6 +6,7 @@
#include "base/base_switches.h"
#include "base/command_line.h"
+#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
@@ -39,6 +40,8 @@ HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr;
base::LazyInstance<HeadlessCrashReporterClient>::Leaky g_headless_crash_client =
LAZY_INSTANCE_INITIALIZER;
+
+const char kLogFileName[] = "CHROME_LOG_FILE";
} // namespace
HeadlessContentMainDelegate::HeadlessContentMainDelegate(
@@ -127,6 +130,12 @@ void HeadlessContentMainDelegate::InitLogging(
log_path = log_filename;
}
+ std::string filename;
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ if (env->GetVar(kLogFileName, &filename) && !filename.empty()) {
+ log_path = base::FilePath::FromUTF8Unsafe(filename);
+ }
+
const std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698