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

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 2736883002: Use CHROME_LOG_FILE environment variable for headless chrome logging (Closed)
Patch Set: 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..5b4e786524342079bffd7db49f49d8d39a873383 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"
@@ -127,6 +128,13 @@ void HeadlessContentMainDelegate::InitLogging(
log_path = log_filename;
}
+ std::string filename;
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ if (env->HasVar("CHROME_LOG_FILE") &&
Sami 2017/03/08 10:38:14 nit: no need to call HasVar since GetVar will just
irisu 2017/03/08 23:56:08 Done.
+ env->GetVar("CHROME_LOG_FILE", &filename) && !filename.empty()) {
Sami 2017/03/08 10:38:13 Could you make this a named constant at the top of
irisu 2017/03/08 23:56:08 Done.
+ 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