Disable logging unless --enable-logging is specified

This commit is contained in:
Cheng Zhao 2015-10-03 15:33:55 +08:00
parent 0f9f8e62fc
commit 3503b62ff2

View file

@ -27,10 +27,10 @@ AtomMainDelegate::~AtomMainDelegate() {
} }
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Disable logging out to debug.log on Windows
logging::LoggingSettings settings; logging::LoggingSettings settings;
#if defined(OS_WIN) #if defined(OS_WIN)
#if defined(DEBUG) #if defined(DEBUG)
// Print logging to debug.log on Windows
settings.logging_dest = logging::LOG_TO_ALL; settings.logging_dest = logging::LOG_TO_ALL;
settings.log_file = L"debug.log"; settings.log_file = L"debug.log";
settings.lock_log = logging::LOCK_LOG_FILE; settings.lock_log = logging::LOCK_LOG_FILE;
@ -41,6 +41,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
#else // defined(OS_WIN) #else // defined(OS_WIN)
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif // !defined(OS_WIN) #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::InitLogging(settings);
// Logging with pid and timestamp. // Logging with pid and timestamp.