diff options
42 files changed, 251 insertions, 309 deletions
diff --git a/base/logging.cc b/base/logging.cc index 49623bf..3b78387 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -85,15 +85,7 @@ const char* const log_severity_names[LOG_NUM_SEVERITIES] = { int min_log_level = 0; -// The default set here for logging_destination will only be used if -// InitLogging is not called. On Windows, use a file next to the exe; -// on POSIX platforms, where it may not even be possible to locate the -// executable on disk, use stderr. -#if defined(OS_WIN) -LoggingDestination logging_destination = LOG_ONLY_TO_FILE; -#elif defined(OS_POSIX) -LoggingDestination logging_destination = LOG_ONLY_TO_SYSTEM_DEBUG_LOG; -#endif +LoggingDestination logging_destination = LOG_DEFAULT; // For LOG_ERROR and above, always print to stderr. const int kAlwaysPrintErrorLevel = LOG_ERROR; @@ -323,8 +315,7 @@ bool InitializeLogFileHandle() { log_file_name = new PathString(GetDefaultLogFile()); } - if (logging_destination == LOG_ONLY_TO_FILE || - logging_destination == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) { + if ((logging_destination & LOG_TO_FILE) != 0) { #if defined(OS_WIN) log_file = CreateFile(log_file_name->c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, @@ -352,17 +343,19 @@ bool InitializeLogFileHandle() { } // namespace +LoggingSettings::LoggingSettings() + : logging_dest(LOG_DEFAULT), + log_file(NULL), + lock_log(LOCK_LOG_FILE), + delete_old(APPEND_TO_OLD_LOG_FILE), + dcheck_state(DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) {} -bool BaseInitLoggingImpl(const PathChar* new_log_file, - LoggingDestination logging_dest, - LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state) { +bool BaseInitLoggingImpl(const LoggingSettings& settings) { #if defined(OS_NACL) - CHECK(logging_dest == LOG_NONE || - logging_dest == LOG_ONLY_TO_SYSTEM_DEBUG_LOG); + // Can log only to the system debug log. + CHECK_EQ(settings.logging_dest & ~LOG_TO_SYSTEM_DEBUG_LOG, 0); #endif - g_dcheck_state = dcheck_state; + g_dcheck_state = settings.dcheck_state; CommandLine* command_line = CommandLine::ForCurrentProcess(); // Don't bother initializing g_vlog_info unless we use one of the // vlog switches. @@ -380,7 +373,7 @@ bool BaseInitLoggingImpl(const PathChar* new_log_file, &min_log_level); } - LoggingLock::Init(lock_log, new_log_file); + LoggingLock::Init(settings.lock_log, settings.log_file); LoggingLock logging_lock; @@ -391,17 +384,16 @@ bool BaseInitLoggingImpl(const PathChar* new_log_file, log_file = NULL; } - logging_destination = logging_dest; + logging_destination = settings.logging_dest; - // ignore file options if logging is disabled or only to system - if (logging_destination == LOG_NONE || - logging_destination == LOG_ONLY_TO_SYSTEM_DEBUG_LOG) + // ignore file options unless logging to file is set. + if ((logging_destination & LOG_TO_FILE) == 0) return true; if (!log_file_name) log_file_name = new PathString(); - *log_file_name = new_log_file; - if (delete_old == DELETE_OLD_LOG_FILE) + *log_file_name = settings.log_file; + if (settings.delete_old == DELETE_OLD_LOG_FILE) DeleteFilePath(*log_file_name); return InitializeLogFileHandle(); @@ -578,14 +570,14 @@ LogMessage::~LogMessage() { std::string str_newline(stream_.str()); // Give any log message handler first dibs on the message. - if (log_message_handler && log_message_handler(severity_, file_, line_, - message_start_, str_newline)) { + if (log_message_handler && + log_message_handler(severity_, file_, line_, + message_start_, str_newline)) { // The handler took care of it, no further processing. return; } - if (logging_destination == LOG_ONLY_TO_SYSTEM_DEBUG_LOG || - logging_destination == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) { + if ((logging_destination & LOG_TO_SYSTEM_DEBUG_LOG) != 0) { #if defined(OS_WIN) OutputDebugStringA(str_newline.c_str()); #elif defined(OS_ANDROID) @@ -627,8 +619,7 @@ LogMessage::~LogMessage() { // thread at the beginning of execution. LoggingLock::Init(LOCK_LOG_FILE, NULL); // write to log file - if (logging_destination != LOG_NONE && - logging_destination != LOG_ONLY_TO_SYSTEM_DEBUG_LOG) { + if ((logging_destination & LOG_TO_FILE) != 0) { LoggingLock logging_lock; if (InitializeLogFileHandle()) { #if defined(OS_WIN) diff --git a/base/logging.h b/base/logging.h index 045ecd4..859f260 100644 --- a/base/logging.h +++ b/base/logging.h @@ -146,22 +146,39 @@ namespace logging { -// Where to record logging output? A flat file and/or system debug log via -// OutputDebugString. Defaults on Windows to LOG_ONLY_TO_FILE, and on -// POSIX to LOG_ONLY_TO_SYSTEM_DEBUG_LOG (aka stderr). -enum LoggingDestination { LOG_NONE, - LOG_ONLY_TO_FILE, - LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG }; +// TODO(avi): do we want to do a unification of character types here? +#if defined(OS_WIN) +typedef wchar_t PathChar; +#else +typedef char PathChar; +#endif + +// Where to record logging output? A flat file and/or system debug log +// via OutputDebugString. +enum LoggingDestination { + LOG_NONE = 0, + LOG_TO_FILE = 1 << 0, + LOG_TO_SYSTEM_DEBUG_LOG = 1 << 1, + + LOG_TO_ALL = LOG_TO_FILE | LOG_TO_SYSTEM_DEBUG_LOG, + + // On Windows, use a file next to the exe; on POSIX platforms, where + // it may not even be possible to locate the executable on disk, use + // stderr. +#if defined(OS_WIN) + LOG_DEFAULT = LOG_TO_FILE, +#elif defined(OS_POSIX) + LOG_DEFAULT = LOG_TO_SYSTEM_DEBUG_LOG, +#endif +}; // Indicates that the log file should be locked when being written to. -// Often, there is no locking, which is fine for a single threaded program. -// If logging is being done from multiple threads or there can be more than -// one process doing the logging, the file should be locked during writes to -// make each log outut atomic. Other writers will block. +// Unless there is only one single-threaded process that is logging to +// the log file, the file should be locked during writes to make each +// log outut atomic. Other writers will block. // // All processes writing to the log file must have their locking set for it to -// work properly. Defaults to DONT_LOCK_LOG_FILE. +// work properly. Defaults to LOCK_LOG_FILE. enum LogLockingState { LOCK_LOG_FILE, DONT_LOCK_LOG_FILE }; // On startup, should we delete or append to an existing log file (if any)? @@ -173,12 +190,26 @@ enum DcheckState { ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS }; -// TODO(avi): do we want to do a unification of character types here? -#if defined(OS_WIN) -typedef wchar_t PathChar; -#else -typedef char PathChar; -#endif +struct BASE_EXPORT LoggingSettings { + // The defaults values are: + // + // logging_dest: LOG_DEFAULT + // log_file: NULL + // lock_log: LOCK_LOG_FILE + // delete_old: APPEND_TO_OLD_LOG_FILE + // dcheck_state: DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS + LoggingSettings(); + + LoggingDestination logging_dest; + + // The three settings below have an effect only when LOG_TO_FILE is + // set in |logging_dest|. + const PathChar* log_file; + LogLockingState lock_log; + OldFileDeletionState delete_old; + + DcheckState dcheck_state; +}; // Define different names for the BaseInitLoggingImpl() function depending on // whether NDEBUG is defined or not so that we'll fail to link if someone tries @@ -193,11 +224,7 @@ typedef char PathChar; // Implementation of the InitLogging() method declared below. We use a // more-specific name so we can #define it above without affecting other code // that has named stuff "InitLogging". -BASE_EXPORT bool BaseInitLoggingImpl(const PathChar* log_file, - LoggingDestination logging_dest, - LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state); +BASE_EXPORT bool BaseInitLoggingImpl(const LoggingSettings& settings); // Sets the log file name and other global logging state. Calling this function // is recommended, and is normally done at the beginning of application init. @@ -213,13 +240,8 @@ BASE_EXPORT bool BaseInitLoggingImpl(const PathChar* log_file, // This function may be called a second time to re-direct logging (e.g after // loging in to a user partition), however it should never be called more than // twice. -inline bool InitLogging(const PathChar* log_file, - LoggingDestination logging_dest, - LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state) { - return BaseInitLoggingImpl(log_file, logging_dest, lock_log, - delete_old, dcheck_state); +inline bool InitLogging(const LoggingSettings& settings) { + return BaseInitLoggingImpl(settings); } // Sets the log level. Anything at or above this level will be written to the diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc index 07b9964..a4b1780 100644 --- a/base/test/test_suite.cc +++ b/base/test/test_suite.cc @@ -221,12 +221,11 @@ void TestSuite::Initialize() { base::FilePath exe; PathService::Get(base::FILE_EXE, &exe); base::FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); - logging::InitLogging( - log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = log_filename.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); // We want process and thread IDs because we may have multiple processes. // Note: temporarily enabled timestamps in an effort to catch bug 6361. logging::SetLogItems(true, true, true, true); diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc index 5180333..e044322 100644 --- a/base/test/test_support_android.cc +++ b/base/test/test_support_android.cc @@ -165,11 +165,9 @@ void InitPathProvider(int key) { namespace base { void InitAndroidTestLogging() { - logging::InitLogging(NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // To view log output with IDs and timestamps use "adb logcat -v threadtime". logging::SetLogItems(false, // Process ID false, // Thread ID diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index cada54f..2393aaa 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -132,13 +132,11 @@ LoggingDestination DetermineLogMode(const CommandLine& command_line) { #ifdef NDEBUG bool enable_logging = false; const char *kInvertLoggingSwitch = switches::kEnableLogging; - const logging::LoggingDestination kDefaultLoggingMode = - logging::LOG_ONLY_TO_FILE; + const logging::LoggingDestination kDefaultLoggingMode = logging::LOG_TO_FILE; #else bool enable_logging = true; const char *kInvertLoggingSwitch = switches::kDisableLogging; - const logging::LoggingDestination kDefaultLoggingMode = - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; + const logging::LoggingDestination kDefaultLoggingMode = logging::LOG_TO_ALL; #endif if (command_line.HasSwitch(kInvertLoggingSwitch)) @@ -149,7 +147,7 @@ LoggingDestination DetermineLogMode(const CommandLine& command_line) { // Let --enable-logging=stderr force only stderr, particularly useful for // non-debug builds where otherwise you can't get logs to stderr at all. if (command_line.GetSwitchValueASCII(switches::kEnableLogging) == "stderr") - log_mode = logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG; + log_mode = logging::LOG_TO_SYSTEM_DEBUG_LOG; else log_mode = kDefaultLoggingMode; } else { @@ -252,11 +250,11 @@ void RedirectChromeLogging(const CommandLine& command_line) { // ChromeOS always logs through the symlink, so it shouldn't be // deleted if it already exists. - if (!InitLogging(log_path.value().c_str(), - DetermineLogMode(command_line), - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - dcheck_state)) { + logging::LoggingSettings settings; + settings.logging_dest = DetermineLogMode(command_line); + settings.log_file = log_path.value().c_str(); + settings.dcheck_state = dcheck_state; + if (!logging::InitLogging(settings)) { DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); RemoveSymlinkAndLog(log_path, target_path); } else { @@ -280,8 +278,7 @@ void InitChromeLogging(const CommandLine& command_line, // Don't resolve the log path unless we need to. Otherwise we leave an open // ALPC handle after sandbox lockdown on Windows. - if (logging_dest == LOG_ONLY_TO_FILE || - logging_dest == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) { + if ((logging_dest & LOG_TO_FILE) != 0) { log_path = GetLogFileName(); #if defined(OS_CHROMEOS) @@ -311,11 +308,13 @@ void InitChromeLogging(const CommandLine& command_line, logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; - bool success = InitLogging(log_path.value().c_str(), - logging_dest, - log_locking_state, - delete_old_log_file, - dcheck_state); + logging::LoggingSettings settings; + settings.logging_dest = logging_dest; + settings.log_file = log_path.value().c_str(); + settings.lock_log = log_locking_state; + settings.delete_old = delete_old_log_file; + settings.dcheck_state = dcheck_state; + bool success = logging::InitLogging(settings); #if defined(OS_CHROMEOS) if (!success) { diff --git a/chrome/installer/gcapi/gcapi_dll.cc b/chrome/installer/gcapi/gcapi_dll.cc index 744321a..cb512e4 100644 --- a/chrome/installer/gcapi/gcapi_dll.cc +++ b/chrome/installer/gcapi/gcapi_dll.cc @@ -22,12 +22,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, if (reason == DLL_PROCESS_ATTACH) { g_exit_manager = new base::AtExitManager(); CommandLine::Init(0, NULL); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); } else if (reason == DLL_PROCESS_DETACH) { CommandLine::Reset(); delete g_exit_manager; diff --git a/chrome/installer/tools/validate_installation_main.cc b/chrome/installer/tools/validate_installation_main.cc index 7cc1161..453f3443 100644 --- a/chrome/installer/tools/validate_installation_main.cc +++ b/chrome/installer/tools/validate_installation_main.cc @@ -61,12 +61,12 @@ logging::LogMessageHandlerFunction ConsoleLogHelper::ConsoleLogHelper() : log_file_path_(GetLogFilePath()) { LOG_ASSERT(old_message_handler_ == NULL); - logging::InitLogging( - log_file_path_.value().c_str(), - logging::LOG_ONLY_TO_FILE, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_FILE; + settings.log_file = log_file_path_.value().c_str(); + settings.lock_log = logging::DONT_LOCK_LOG_FILE; + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); old_message_handler_ = logging::GetLogMessageHandler(); logging::SetLogMessageHandler(&DumpLogMessage); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 2e47269..f31ceac 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -89,12 +89,10 @@ void InitInstallerLogging(const installer::MasterPreferences& prefs) { base::FilePath log_file_path(GetLogFilePath(prefs)); TruncateLogFileIfNeeded(log_file_path); - logging::InitLogging( - log_file_path.value().c_str(), - logging::LOG_ONLY_TO_FILE, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_FILE; + settings.log_file = log_file_path.value().c_str(); + logging::InitLogging(settings); if (prefs.GetBool(installer::master_preferences::kVerboseLogging, &value) && value) { diff --git a/chrome/test/chromedriver/server/chromedriver_server.cc b/chrome/test/chromedriver/server/chromedriver_server.cc index f0c4afe..b95da97 100644 --- a/chrome/test/chromedriver/server/chromedriver_server.cc +++ b/chrome/test/chromedriver/server/chromedriver_server.cc @@ -144,12 +144,9 @@ int main(int argc, char *argv[]) { } } - bool success = InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + bool success = logging::InitLogging(settings); if (!success) { PLOG(ERROR) << "Unable to initialize logging"; } diff --git a/chrome/test/webdriver/webdriver_logging.cc b/chrome/test/webdriver/webdriver_logging.cc index 7a56f06..bd0de22 100644 --- a/chrome/test/webdriver/webdriver_logging.cc +++ b/chrome/test/webdriver/webdriver_logging.cc @@ -228,12 +228,9 @@ bool InitWebDriverLogging(const base::FilePath& log_path, LogLevel min_log_level) { start_time = base::Time::Now().ToDoubleT(); // Turn off base/logging. - bool success = InitLogging( - NULL, - logging::LOG_NONE, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_NONE; + bool success = logging::InitLogging(settings); if (!success) { PLOG(ERROR) << "Unable to initialize logging"; } diff --git a/chrome/tools/crash_service/main.cc b/chrome/tools/crash_service/main.cc index 525801d..de4b37a 100644 --- a/chrome/tools/crash_service/main.cc +++ b/chrome/tools/crash_service/main.cc @@ -46,12 +46,10 @@ int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line, // Logging to stderr (to help with debugging failures on the // buildbots) and to a file. - logging::InitLogging( - log_file.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = log_file.value().c_str(); + logging::InitLogging(settings); // Logging with pid, tid and timestamp. logging::SetLogItems(true, true, true, false); diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc index a0af6e3..a563ded 100644 --- a/chrome_frame/chrome_tab.cc +++ b/chrome_frame/chrome_tab.cc @@ -868,12 +868,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, g_exit_manager = new base::AtExitManager(); CommandLine::Init(0, NULL); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // Log the same items as Chrome. logging::SetLogItems(true, // enable_process_id diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc index e9766ab..bbb4637 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -434,11 +434,10 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); CommandLine::Init(argc, argv); - logging::InitLogging( - L"CON", - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = L"CON"; + settings.lock_log = logging::DONT_LOCK_LOG_FILE; + logging::InitLogging(settings); return RUN_ALL_TESTS(); } diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index a8e811f..8ec91be 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -727,12 +727,11 @@ void CFUrlRequestUnittestRunner::InitializeLogging() { base::FilePath exe; PathService::Get(base::FILE_EXE, &exe); base::FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); - logging::InitLogging( - log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = log_filename.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); // We want process and thread IDs because we may have multiple processes. // Note: temporarily enabled timestamps in an effort to catch bug 6361. logging::SetLogItems(true, true, true, true); diff --git a/cloud_print/gcp20/prototype/gcp20_device.cc b/cloud_print/gcp20/prototype/gcp20_device.cc index f210063..2ff1a2d 100644 --- a/cloud_print/gcp20/prototype/gcp20_device.cc +++ b/cloud_print/gcp20/prototype/gcp20_device.cc @@ -12,11 +12,9 @@ int main(int argc, char* argv[]) { CommandLine::Init(argc, argv); - logging::InitLogging(NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); DnsSdServer dns_sd_server; dns_sd_server.Start(); diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc index 5a3c502..e93ad05 100644 --- a/cloud_print/service/win/cloud_print_service.cc +++ b/cloud_print/service/win/cloud_print_service.cc @@ -401,11 +401,9 @@ int main(int argc, char** argv) { CommandLine::Init(argc, argv); base::AtExitManager at_exit; - logging::InitLogging(NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); logging::SetMinLogLevel( CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableLogging) ? diff --git a/content/app/android/library_loader_hooks.cc b/content/app/android/library_loader_hooks.cc index 9af580e..725491d 100644 --- a/content/app/android/library_loader_hooks.cc +++ b/content/app/android/library_loader_hooks.cc @@ -55,15 +55,13 @@ static jint LibraryLoaded(JNIEnv* env, jclass clazz, // Note: because logging is setup here right after copying the command line // array from java to native up top of this method, any code that adds the // --enable-dcheck switch must do so on the Java side. - logging::DcheckState dcheck_state = + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + settings.dcheck_state = command_line->HasSwitch(switches::kEnableDCHECK) ? logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; - logging::InitLogging(NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - dcheck_state); + logging::InitLogging(settings); // To view log output with IDs and timestamps use "adb logcat -v threadtime". logging::SetLogItems(false, // Process ID false, // Thread ID diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc index 43227d6..b4ce484 100644 --- a/content/common/gpu/media/video_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc @@ -944,12 +944,11 @@ int main(int argc, char **argv) { CommandLine::Init(argc, argv); // Needed to enable DVLOG through --vmodule. - CHECK(logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + settings.dcheck_state = + logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; + CHECK(logging::InitLogging(settings)); CommandLine* cmd_line = CommandLine::ForCurrentProcess(); DCHECK(cmd_line); diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc index 6064067..e594107 100644 --- a/content/shell/app/shell_main_delegate.cc +++ b/content/shell/app/shell_main_delegate.cc @@ -71,12 +71,11 @@ void InitLogging() { base::FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); log_filename = log_filename.AppendASCII("content_shell.log"); - logging::InitLogging( - log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = log_filename.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); logging::SetLogItems(true, true, true, true); } diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index 6aa951a..1d8b77d 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -424,12 +424,10 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - (void)logging::InitLogging( - FILE_PATH_LITERAL("courgette.log"), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = FILE_PATH_LITERAL("courgette.log"); + (void)logging::InitLogging(settings); logging::SetMinLogLevel(logging::LOG_VERBOSE); bool cmd_sup = command_line.HasSwitch("supported"); diff --git a/jingle/glue/logging_unittest.cc b/jingle/glue/logging_unittest.cc index a9f0d8e..85ac558 100644 --- a/jingle/glue/logging_unittest.cc +++ b/jingle/glue/logging_unittest.cc @@ -58,9 +58,12 @@ static bool Initialize(int verbosity_level) { } // The command line flags are parsed here and the log file name is set. - if (!InitLogging(log_file_name, logging::LOG_ONLY_TO_FILE, - logging::DONT_LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) { + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_FILE; + settings.log_file = log_file_name; + settings.lock_log = logging::DONT_LOCK_LOG_FILE; + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + if (!logging::InitLogging(settings)) { return false; } EXPECT_TRUE(VLOG_IS_ON(verbosity_level)); diff --git a/media/tools/media_bench/media_bench.cc b/media/tools/media_bench/media_bench.cc index 6c790c8..0948a96 100644 --- a/media/tools/media_bench/media_bench.cc +++ b/media/tools/media_bench/media_bench.cc @@ -92,12 +92,9 @@ int main(int argc, const char** argv) { CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, // Ignored. - logging::DELETE_OLD_LOG_FILE, // Ignored. - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); const CommandLine::StringVector& filenames = cmd_line->GetArgs(); diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc index efa7573..cb2b4d7 100644 --- a/media/tools/player_x11/player_x11.cc +++ b/media/tools/player_x11/player_x11.cc @@ -249,12 +249,9 @@ int main(int argc, char** argv) { scoped_ptr<media::AudioManager> audio_manager(media::AudioManager::Create()); g_audio_manager = audio_manager.get(); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, // Ignored. - logging::DELETE_OLD_LOG_FILE, // Ignored. - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // Install the signal handler. signal(SIGTERM, &TerminateHandler); diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 65eb01a..0da9845 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -270,9 +270,9 @@ int main(int argc, const char* argv[]) { logging::LogEventProvider::Initialize(kStressCacheTraceProviderName); #else CommandLine::Init(argc, argv); - logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); #endif // Some time for the memory manager to flush stuff. diff --git a/net/tools/flip_server/flip_config.cc b/net/tools/flip_server/flip_config.cc index 8d78924..eb5c3ca 100644 --- a/net/tools/flip_server/flip_config.cc +++ b/net/tools/flip_server/flip_config.cc @@ -97,7 +97,7 @@ FlipAcceptor::~FlipAcceptor() {} FlipConfig::FlipConfig() : server_think_time_in_s_(0), - log_destination_(logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG), + log_destination_(logging::LOG_TO_SYSTEM_DEBUG_LOG), wait_for_iface_(false) { } diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index 15fb9644..e6c32aa 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -227,12 +227,11 @@ int main (int argc, char**argv) if (cl.HasSwitch("logdest")) { std::string log_dest_value = cl.GetSwitchValueASCII("logdest"); if (log_dest_value.compare("file") == 0) { - g_proxy_config.log_destination_ = logging::LOG_ONLY_TO_FILE; + g_proxy_config.log_destination_ = logging::LOG_TO_FILE; } else if (log_dest_value.compare("system") == 0) { - g_proxy_config.log_destination_ = logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG; + g_proxy_config.log_destination_ = logging::LOG_TO_SYSTEM_DEBUG_LOG; } else if (log_dest_value.compare("both") == 0) { - g_proxy_config.log_destination_ = - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; + g_proxy_config.log_destination_ = logging::LOG_TO_ALL; } else { LOG(FATAL) << "Invalid logging destination value: " << log_dest_value; } @@ -243,11 +242,9 @@ int main (int argc, char**argv) if (cl.HasSwitch("logfile")) { g_proxy_config.log_filename_ = cl.GetSwitchValueASCII("logfile"); if (g_proxy_config.log_destination_ == logging::LOG_NONE) { - g_proxy_config.log_destination_ = logging::LOG_ONLY_TO_FILE; + g_proxy_config.log_destination_ = logging::LOG_TO_FILE; } - } else if (g_proxy_config.log_destination_ == logging::LOG_ONLY_TO_FILE || - g_proxy_config.log_destination_ == - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) { + } else if ((g_proxy_config.log_destination_ & logging::LOG_TO_FILE) != 0) { LOG(FATAL) << "Logging destination requires a log file to be specified."; } @@ -272,11 +269,11 @@ int main (int argc, char**argv) if (cl.HasSwitch("force_spdy")) net::SMConnection::set_force_spdy(true); - InitLogging(g_proxy_config.log_filename_.c_str(), - g_proxy_config.log_destination_, - logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = g_proxy_config.log_destination_; + settings.log_file = g_proxy_config.log_filename_.c_str(); + settings.lock_log = logging::DONT_LOCK_LOG_FILE; + logging::InitLogging(settings); LOG(INFO) << "Flip SPDY proxy started with configuration:"; LOG(INFO) << "Logging destination : " << g_proxy_config.log_destination_; diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc index 23b9304..c356212 100644 --- a/net/tools/get_server_time/get_server_time.cc +++ b/net/tools/get_server_time/get_server_time.cc @@ -230,12 +230,9 @@ int main(int argc, char* argv[]) { base::AtExitManager exit_manager; CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); GURL url(parsed_command_line.GetSwitchValueASCII("url")); diff --git a/net/tools/net_watcher/net_watcher.cc b/net/tools/net_watcher/net_watcher.cc index 18fd41d..ec1209b 100644 --- a/net/tools/net_watcher/net_watcher.cc +++ b/net/tools/net_watcher/net_watcher.cc @@ -153,12 +153,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) base::AtExitManager exit_manager; CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // Just make the main message loop the network loop. base::MessageLoopForIO network_loop; diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index 9f5f561..59b75f1 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -28,12 +28,10 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (!logging::InitLogging( - FILE_PATH_LITERAL("testserver.log"), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) { + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = FILE_PATH_LITERAL("testserver.log"); + if (!logging::InitLogging(settings)) { printf("Error: could not initialize logging. Exiting.\n"); return -1; } diff --git a/net/tools/tld_cleanup/tld_cleanup.cc b/net/tools/tld_cleanup/tld_cleanup.cc index 485bece..ec678ff 100644 --- a/net/tools/tld_cleanup/tld_cleanup.cc +++ b/net/tools/tld_cleanup/tld_cleanup.cc @@ -47,10 +47,10 @@ int main(int argc, const char* argv[]) { // Only use OutputDebugString in debug mode. #ifdef NDEBUG - logging::LoggingDestination destination = logging::LOG_ONLY_TO_FILE; + logging::LoggingDestination destination = logging::LOG_TO_FILE; #else logging::LoggingDestination destination = - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; + logging::LOG_TO_ALL; #endif CommandLine::Init(argc, argv); @@ -58,12 +58,11 @@ int main(int argc, const char* argv[]) { base::FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); log_filename = log_filename.AppendASCII("tld_cleanup.log"); - logging::InitLogging( - log_filename.value().c_str(), - destination, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = destination; + settings.log_file = log_filename.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); icu_util::Initialize(); diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc index 770ebd2..e6ee97d 100644 --- a/ppapi/proxy/plugin_main_nacl.cc +++ b/ppapi/proxy/plugin_main_nacl.cc @@ -190,12 +190,9 @@ void PpapiDispatcher::OnMsgCreateNaClChannel( CommandLine::ForCurrentProcess()->AppendSwitchASCII( args.switch_names[i], args.switch_values[i]); } - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); command_line_and_logging_initialized = true; } // Tell the process-global GetInterface which interfaces it can return to the diff --git a/remoting/host/logging_posix.cc b/remoting/host/logging_posix.cc index fa6be18..d29086e 100644 --- a/remoting/host/logging_posix.cc +++ b/remoting/host/logging_posix.cc @@ -10,12 +10,9 @@ namespace remoting { void InitHostLogging() { // Write logs to the system debug log. - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); } } // namespace remoting diff --git a/remoting/host/logging_win.cc b/remoting/host/logging_win.cc index fa4b7ab..be69773 100644 --- a/remoting/host/logging_win.cc +++ b/remoting/host/logging_win.cc @@ -18,12 +18,9 @@ namespace remoting { void InitHostLogging() { // Write logs to the system debug log. - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // Enable trace control and transport through event tracing for Windows. logging::LogEventProvider::Initialize(kRemotingHostLogProvider); diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc index c6a5e5b..6ce8bde 100644 --- a/sync/tools/sync_client.cc +++ b/sync/tools/sync_client.cc @@ -230,12 +230,9 @@ int SyncClientMain(int argc, char* argv[]) { #endif base::AtExitManager exit_manager; CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); base::MessageLoop sync_loop; base::Thread io_thread("IO thread"); diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc index 92fde0e..dc54886 100644 --- a/sync/tools/sync_listen_notifications.cc +++ b/sync/tools/sync_listen_notifications.cc @@ -150,12 +150,9 @@ int SyncListenNotificationsMain(int argc, char* argv[]) { #endif base::AtExitManager exit_manager; CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); base::MessageLoop ui_loop; base::Thread io_thread("IO thread"); diff --git a/sync/tools/testserver/run_sync_testserver.cc b/sync/tools/testserver/run_sync_testserver.cc index 589333b..c9cb297 100644 --- a/sync/tools/testserver/run_sync_testserver.cc +++ b/sync/tools/testserver/run_sync_testserver.cc @@ -76,12 +76,10 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (!logging::InitLogging( - FILE_PATH_LITERAL("sync_testserver.log"), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) { + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = FILE_PATH_LITERAL("sync_testserver.log"); + if (!logging::InitLogging(settings)) { printf("Error: could not initialize logging. Exiting.\n"); return -1; } diff --git a/third_party/libjingle/overrides/initialize_module.cc b/third_party/libjingle/overrides/initialize_module.cc index 9262629..c54ae56 100644 --- a/third_party/libjingle/overrides/initialize_module.cc +++ b/third_party/libjingle/overrides/initialize_module.cc @@ -67,12 +67,9 @@ bool InitializeModule(const CommandLine& command_line, // done the equivalent thing via the GetCommandLine() API. CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); #endif - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); // Override the log message handler to forward logs to chrome's handler. logging::SetLogMessageHandler(log_handler); diff --git a/tools/android/forwarder2/daemon.cc b/tools/android/forwarder2/daemon.cc index 5562116..afbf41c 100644 --- a/tools/android/forwarder2/daemon.cc +++ b/tools/android/forwarder2/daemon.cc @@ -40,13 +40,15 @@ const int kNumTries = 100; const int kIdleTimeMSec = 20; void InitLoggingForDaemon(const std::string& log_file) { - CHECK( - logging::InitLogging( - log_file.c_str(), - log_file.empty() ? - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG : logging::LOG_ONLY_TO_FILE, - logging::DONT_LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE, - logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); + logging::LoggingSettings settings; + settings.logging_dest = + log_file.empty() ? + logging::LOG_TO_SYSTEM_DEBUG_LOG : logging::LOG_TO_FILE; + settings.log_file = log_file.c_str(); + settings.lock_log = logging::DONT_LOCK_LOG_FILE; + settings.dcheck_state = + logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; + CHECK(logging::InitLogging(settings)); } bool RunServerAcceptLoop(const std::string& welcome_message, diff --git a/tools/set_default_handler/set_default_handler_main.cc b/tools/set_default_handler/set_default_handler_main.cc index dad4536..7f2d9da 100644 --- a/tools/set_default_handler/set_default_handler_main.cc +++ b/tools/set_default_handler/set_default_handler_main.cc @@ -31,10 +31,11 @@ int wmain(int argc, wchar_t* argv[]) { CommandLine::Init(0, NULL); // The exit manager is in charge of calling the dtors of singletons. base::AtExitManager exit_manager; - logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + settings.dcheck_state = + logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; + logging::InitLogging(settings); logging::SetMinLogLevel(logging::LOG_VERBOSE); ui::win::CreateATLModuleIfNeeded(); diff --git a/ui/views/examples/content_client/examples_main_delegate.cc b/ui/views/examples/content_client/examples_main_delegate.cc index 0d17249..c6241e9 100644 --- a/ui/views/examples/content_client/examples_main_delegate.cc +++ b/ui/views/examples/content_client/examples_main_delegate.cc @@ -45,11 +45,9 @@ bool ExamplesMainDelegate::BasicStartupComplete(int* exit_code) { content::SetContentClient(&content_client_); - bool success = logging::InitLogging(NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + bool success = logging::InitLogging(settings); CHECK(success); #if defined(OS_WIN) logging::LogEventProvider::Initialize(kViewsExamplesProviderName); diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 8c8961f..0e0997f 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -116,15 +116,13 @@ void InitLogging() { base::FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); log_filename = log_filename.AppendASCII("DumpRenderTree.log"); - logging::InitLogging( - log_filename.value().c_str(), - // Only log to a file. This prevents debugging output from disrupting - // whether or not we pass. - logging::LOG_ONLY_TO_FILE, - // We might have multiple DumpRenderTree processes going at once. - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + // Only log to a file. This prevents debugging output from disrupting + // whether or not we pass. + settings.logging_dest = logging::LOG_TO_FILE; + settings.log_file = log_filename.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; + logging::InitLogging(settings); // We want process and thread IDs because we may have multiple processes. const bool kProcessId = true; diff --git a/win8/metro_driver/metro_driver.cc b/win8/metro_driver/metro_driver.cc index 87efa20..940b5b1 100644 --- a/win8/metro_driver/metro_driver.cc +++ b/win8/metro_driver/metro_driver.cc @@ -62,12 +62,9 @@ extern "C" __declspec(dllexport) int InitMetro(LPTHREAD_START_ROUTINE thread_proc, void* context) { // Initialize the command line. CommandLine::Init(0, NULL); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); #if defined(NDEBUG) logging::SetMinLogLevel(logging::LOG_ERROR); |