From: Cheng Zhao Date: Sat, 3 Oct 2015 07:33:55 +0000 (+0800) Subject: Disable logging unless --enable-logging is specified X-Git-Tag: v0.33.5~12^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=3503b62ff290f7897ca1f0cf304dbc6b630152c0;p=electron.git Disable logging unless --enable-logging is specified --- diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index 3c7d6b2e..fe3c0e09 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -27,10 +27,10 @@ AtomMainDelegate::~AtomMainDelegate() { } bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { - // Disable logging out to debug.log on Windows logging::LoggingSettings settings; #if defined(OS_WIN) #if defined(DEBUG) + // Print logging to debug.log on Windows settings.logging_dest = logging::LOG_TO_ALL; settings.log_file = L"debug.log"; settings.lock_log = logging::LOCK_LOG_FILE; @@ -41,6 +41,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { #else // defined(OS_WIN) settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; #endif // !defined(OS_WIN) + + // Only enable logging when --enable-logging is specified. + auto command_line = base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kEnableLogging)) + settings.logging_dest = logging::LOG_NONE; + logging::InitLogging(settings); // Logging with pid and timestamp.