| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 // Need to include this before most other files because it defines | 7 // Need to include this before most other files because it defines |
| 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
| 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the | 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the |
| 10 // ViewMsgLog et al. functions. | 10 // ViewMsgLog et al. functions. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "base/debug/dump_without_crashing.h" | 40 #include "base/debug/dump_without_crashing.h" |
| 41 #include "base/environment.h" | 41 #include "base/environment.h" |
| 42 #include "base/files/file_path.h" | 42 #include "base/files/file_path.h" |
| 43 #include "base/files/file_util.h" | 43 #include "base/files/file_util.h" |
| 44 #include "base/metrics/statistics_recorder.h" | 44 #include "base/metrics/statistics_recorder.h" |
| 45 #include "base/path_service.h" | 45 #include "base/path_service.h" |
| 46 #include "base/strings/string_number_conversions.h" | 46 #include "base/strings/string_number_conversions.h" |
| 47 #include "base/strings/string_util.h" | 47 #include "base/strings/string_util.h" |
| 48 #include "base/strings/stringprintf.h" | 48 #include "base/strings/stringprintf.h" |
| 49 #include "base/strings/utf_string_conversions.h" | 49 #include "base/strings/utf_string_conversions.h" |
| 50 #include "base/threading/thread_restrictions.h" |
| 50 #include "chrome/common/chrome_constants.h" | 51 #include "chrome/common/chrome_constants.h" |
| 51 #include "chrome/common/chrome_paths.h" | 52 #include "chrome/common/chrome_paths.h" |
| 52 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/env_vars.h" | 54 #include "chrome/common/env_vars.h" |
| 54 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
| 55 #include "ipc/ipc_logging.h" | 56 #include "ipc/ipc_logging.h" |
| 56 | 57 |
| 57 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 58 #include "chromeos/chromeos_switches.h" | 59 #include "chromeos/chromeos_switches.h" |
| 59 #endif | 60 #endif |
| 60 | 61 |
| 61 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 62 #include <initguid.h> | 63 #include <initguid.h> |
| 63 #include "base/logging_win.h" | 64 #include "base/logging_win.h" |
| 64 #include "base/syslog_logging.h" | 65 #include "base/syslog_logging.h" |
| 65 #include "chrome/install_static/install_details.h" | 66 #include "chrome/install_static/install_details.h" |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 namespace logging { | |
| 69 namespace { | 69 namespace { |
| 70 | 70 |
| 71 // When true, this means that error dialogs should not be shown. | 71 // When true, this means that error dialogs should not be shown. |
| 72 bool dialogs_are_suppressed_ = false; | 72 bool dialogs_are_suppressed_ = false; |
| 73 ScopedLogAssertHandler* assert_handler_ = nullptr; | 73 logging::ScopedLogAssertHandler* assert_handler_ = nullptr; |
| 74 | 74 |
| 75 // This should be true for exactly the period between the end of | 75 // This should be true for exactly the period between the end of |
| 76 // InitChromeLogging() and the beginning of CleanupChromeLogging(). | 76 // InitChromeLogging() and the beginning of CleanupChromeLogging(). |
| 77 bool chrome_logging_initialized_ = false; | 77 bool chrome_logging_initialized_ = false; |
| 78 | 78 |
| 79 // Set if we called InitChromeLogging() but failed to initialize. | 79 // Set if we called InitChromeLogging() but failed to initialize. |
| 80 bool chrome_logging_failed_ = false; | 80 bool chrome_logging_failed_ = false; |
| 81 | 81 |
| 82 // This should be true for exactly the period between the end of | 82 // This should be true for exactly the period between the end of |
| 83 // InitChromeLogging() and the beginning of CleanupChromeLogging(). | 83 // InitChromeLogging() and the beginning of CleanupChromeLogging(). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 base::debug::BreakDebugger(); | 101 base::debug::BreakDebugger(); |
| 102 } | 102 } |
| 103 MSVC_ENABLE_OPTIMIZE(); | 103 MSVC_ENABLE_OPTIMIZE(); |
| 104 | 104 |
| 105 // Suppresses error/assertion dialogs and enables the logging of | 105 // Suppresses error/assertion dialogs and enables the logging of |
| 106 // those errors into silenced_errors_. | 106 // those errors into silenced_errors_. |
| 107 void SuppressDialogs() { | 107 void SuppressDialogs() { |
| 108 if (dialogs_are_suppressed_) | 108 if (dialogs_are_suppressed_) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 assert_handler_ = | 111 assert_handler_ = new logging::ScopedLogAssertHandler( |
| 112 new ScopedLogAssertHandler(base::Bind(SilentRuntimeAssertHandler)); | 112 base::Bind(SilentRuntimeAssertHandler)); |
| 113 | 113 |
| 114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 115 UINT new_flags = SEM_FAILCRITICALERRORS | | 115 UINT new_flags = SEM_FAILCRITICALERRORS | |
| 116 SEM_NOGPFAULTERRORBOX | | 116 SEM_NOGPFAULTERRORBOX | |
| 117 SEM_NOOPENFILEERRORBOX; | 117 SEM_NOOPENFILEERRORBOX; |
| 118 | 118 |
| 119 // Preserve existing error mode, as discussed at http://t/dmea | 119 // Preserve existing error mode, as discussed at http://t/dmea |
| 120 UINT existing_flags = SetErrorMode(new_flags); | 120 UINT existing_flags = SetErrorMode(new_flags); |
| 121 SetErrorMode(existing_flags | new_flags); | 121 SetErrorMode(existing_flags | new_flags); |
| 122 #endif | 122 #endif |
| 123 | 123 |
| 124 dialogs_are_suppressed_ = true; | 124 dialogs_are_suppressed_ = true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // anonymous namespace | 127 } // anonymous namespace |
| 128 | 128 |
| 129 LoggingDestination DetermineLoggingDestination( | 129 namespace logging { |
| 130 const base::CommandLine& command_line) { | 130 |
| 131 // only use OutputDebugString in debug mode | 131 LoggingDestination DetermineLogMode(const base::CommandLine& command_line) { |
| 132 // only use OutputDebugString in debug mode |
| 132 #ifdef NDEBUG | 133 #ifdef NDEBUG |
| 133 bool enable_logging = false; | 134 bool enable_logging = false; |
| 134 const char *kInvertLoggingSwitch = switches::kEnableLogging; | 135 const char *kInvertLoggingSwitch = switches::kEnableLogging; |
| 135 const LoggingDestination kDefaultLoggingMode = LOG_TO_FILE; | 136 const logging::LoggingDestination kDefaultLoggingMode = logging::LOG_TO_FILE; |
| 136 #else | 137 #else |
| 137 bool enable_logging = true; | 138 bool enable_logging = true; |
| 138 const char *kInvertLoggingSwitch = switches::kDisableLogging; | 139 const char *kInvertLoggingSwitch = switches::kDisableLogging; |
| 139 const LoggingDestination kDefaultLoggingMode = LOG_TO_ALL; | 140 const logging::LoggingDestination kDefaultLoggingMode = logging::LOG_TO_ALL; |
| 140 #endif | 141 #endif |
| 141 | 142 |
| 142 if (command_line.HasSwitch(kInvertLoggingSwitch)) | 143 if (command_line.HasSwitch(kInvertLoggingSwitch)) |
| 143 enable_logging = !enable_logging; | 144 enable_logging = !enable_logging; |
| 144 | 145 |
| 145 LoggingDestination log_mode; | 146 logging::LoggingDestination log_mode; |
| 146 if (enable_logging) { | 147 if (enable_logging) { |
| 147 // Let --enable-logging=stderr force only stderr, particularly useful for | 148 // Let --enable-logging=stderr force only stderr, particularly useful for |
| 148 // non-debug builds where otherwise you can't get logs to stderr at all. | 149 // non-debug builds where otherwise you can't get logs to stderr at all. |
| 149 if (command_line.GetSwitchValueASCII(switches::kEnableLogging) == "stderr") | 150 if (command_line.GetSwitchValueASCII(switches::kEnableLogging) == "stderr") |
| 150 log_mode = LOG_TO_SYSTEM_DEBUG_LOG; | 151 log_mode = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 151 else | 152 else |
| 152 log_mode = kDefaultLoggingMode; | 153 log_mode = kDefaultLoggingMode; |
| 153 } else { | 154 } else { |
| 154 log_mode = LOG_NONE; | 155 log_mode = logging::LOG_NONE; |
| 155 } | 156 } |
| 156 return log_mode; | 157 return log_mode; |
| 157 } | 158 } |
| 158 | 159 |
| 159 #if defined(OS_CHROMEOS) | 160 #if defined(OS_CHROMEOS) |
| 161 namespace { |
| 160 base::FilePath SetUpSymlinkIfNeeded(const base::FilePath& symlink_path, | 162 base::FilePath SetUpSymlinkIfNeeded(const base::FilePath& symlink_path, |
| 161 bool new_log) { | 163 bool new_log) { |
| 162 DCHECK(!symlink_path.empty()); | 164 DCHECK(!symlink_path.empty()); |
| 163 | 165 |
| 164 // If not starting a new log, then just log through the existing | 166 // If not starting a new log, then just log through the existing |
| 165 // symlink, but if the symlink doesn't exist, create it. If | 167 // symlink, but if the symlink doesn't exist, create it. If |
| 166 // starting a new log, then delete the old symlink and make a new | 168 // starting a new log, then delete the old symlink and make a new |
| 167 // one to a fresh log file. | 169 // one to a fresh log file. |
| 168 base::FilePath target_path; | 170 base::FilePath target_path; |
| 169 bool symlink_exists = base::PathExists(symlink_path); | 171 bool symlink_exists = base::PathExists(symlink_path); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 187 } | 189 } |
| 188 | 190 |
| 189 void RemoveSymlinkAndLog(const base::FilePath& link_path, | 191 void RemoveSymlinkAndLog(const base::FilePath& link_path, |
| 190 const base::FilePath& target_path) { | 192 const base::FilePath& target_path) { |
| 191 if (::unlink(link_path.value().c_str()) == -1) | 193 if (::unlink(link_path.value().c_str()) == -1) |
| 192 DPLOG(WARNING) << "Unable to unlink symlink " << link_path.value(); | 194 DPLOG(WARNING) << "Unable to unlink symlink " << link_path.value(); |
| 193 if (::unlink(target_path.value().c_str()) == -1) | 195 if (::unlink(target_path.value().c_str()) == -1) |
| 194 DPLOG(WARNING) << "Unable to unlink log file " << target_path.value(); | 196 DPLOG(WARNING) << "Unable to unlink log file " << target_path.value(); |
| 195 } | 197 } |
| 196 | 198 |
| 199 } // anonymous namespace |
| 200 |
| 197 base::FilePath GetSessionLogDir(const base::CommandLine& command_line) { | 201 base::FilePath GetSessionLogDir(const base::CommandLine& command_line) { |
| 198 base::FilePath log_dir; | 202 base::FilePath log_dir; |
| 199 std::string log_dir_str; | 203 std::string log_dir_str; |
| 200 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 204 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 201 if (env->GetVar(env_vars::kSessionLogDir, &log_dir_str) && | 205 if (env->GetVar(env_vars::kSessionLogDir, &log_dir_str) && |
| 202 !log_dir_str.empty()) { | 206 !log_dir_str.empty()) { |
| 203 log_dir = base::FilePath(log_dir_str); | 207 log_dir = base::FilePath(log_dir_str); |
| 204 } else if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { | 208 } else if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { |
| 205 PathService::Get(chrome::DIR_USER_DATA, &log_dir); | 209 PathService::Get(chrome::DIR_USER_DATA, &log_dir); |
| 206 base::FilePath profile_dir; | 210 base::FilePath profile_dir; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 217 } | 221 } |
| 218 log_dir = log_dir.Append(profile_dir); | 222 log_dir = log_dir.Append(profile_dir); |
| 219 } | 223 } |
| 220 return log_dir; | 224 return log_dir; |
| 221 } | 225 } |
| 222 | 226 |
| 223 base::FilePath GetSessionLogFile(const base::CommandLine& command_line) { | 227 base::FilePath GetSessionLogFile(const base::CommandLine& command_line) { |
| 224 return GetSessionLogDir(command_line).Append(GetLogFileName().BaseName()); | 228 return GetSessionLogDir(command_line).Append(GetLogFileName().BaseName()); |
| 225 } | 229 } |
| 226 | 230 |
| 231 void RedirectChromeLogging(const base::CommandLine& command_line) { |
| 232 if (chrome_logging_redirected_) { |
| 233 // TODO(nkostylev): Support multiple active users. http://crbug.com/230345 |
| 234 LOG(WARNING) << "NOT redirecting logging for multi-profiles case."; |
| 235 return; |
| 236 } |
| 237 |
| 238 DCHECK(!chrome_logging_redirected_) << |
| 239 "Attempted to redirect logging when it was already initialized."; |
| 240 |
| 241 // Redirect logs to the session log directory, if set. Otherwise |
| 242 // defaults to the profile dir. |
| 243 base::FilePath log_path = GetSessionLogFile(command_line); |
| 244 |
| 245 // Creating symlink causes us to do blocking IO on UI thread. |
| 246 // Temporarily allow it until we fix http://crbug.com/61143 |
| 247 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 248 // Always force a new symlink when redirecting. |
| 249 base::FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); |
| 250 |
| 251 // ChromeOS always logs through the symlink, so it shouldn't be |
| 252 // deleted if it already exists. |
| 253 logging::LoggingSettings settings; |
| 254 settings.logging_dest = DetermineLogMode(command_line); |
| 255 settings.log_file = log_path.value().c_str(); |
| 256 if (!logging::InitLogging(settings)) { |
| 257 DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); |
| 258 RemoveSymlinkAndLog(log_path, target_path); |
| 259 } else { |
| 260 chrome_logging_redirected_ = true; |
| 261 } |
| 262 } |
| 263 |
| 227 #endif // OS_CHROMEOS | 264 #endif // OS_CHROMEOS |
| 228 | 265 |
| 229 void InitChromeLogging(const base::CommandLine& command_line, | 266 void InitChromeLogging(const base::CommandLine& command_line, |
| 230 OldFileDeletionState delete_old_log_file) { | 267 OldFileDeletionState delete_old_log_file) { |
| 231 DCHECK(!chrome_logging_initialized_) << | 268 DCHECK(!chrome_logging_initialized_) << |
| 232 "Attempted to initialize logging when it was already initialized."; | 269 "Attempted to initialize logging when it was already initialized."; |
| 233 | 270 |
| 234 LoggingDestination logging_dest = DetermineLoggingDestination(command_line); | 271 LoggingDestination logging_dest = DetermineLogMode(command_line); |
| 235 LogLockingState log_locking_state = LOCK_LOG_FILE; | 272 LogLockingState log_locking_state = LOCK_LOG_FILE; |
| 236 base::FilePath log_path; | 273 base::FilePath log_path; |
| 237 #if defined(OS_CHROMEOS) | 274 #if defined(OS_CHROMEOS) |
| 238 base::FilePath target_path; | 275 base::FilePath target_path; |
| 239 #endif | 276 #endif |
| 240 | 277 |
| 241 // Don't resolve the log path unless we need to. Otherwise we leave an open | 278 // Don't resolve the log path unless we need to. Otherwise we leave an open |
| 242 // ALPC handle after sandbox lockdown on Windows. | 279 // ALPC handle after sandbox lockdown on Windows. |
| 243 if ((logging_dest & LOG_TO_FILE) != 0) { | 280 if ((logging_dest & LOG_TO_FILE) != 0) { |
| 244 log_path = GetLogFileName(); | 281 log_path = GetLogFileName(); |
| 245 | 282 |
| 246 #if defined(OS_CHROMEOS) | 283 #if defined(OS_CHROMEOS) |
| 247 // For BWSI (Incognito) logins, we want to put the logs in the user | 284 // For BWSI (Incognito) logins, we want to put the logs in the user |
| 248 // profile directory that is created for the temporary session instead | 285 // profile directory that is created for the temporary session instead |
| 249 // of in the system log directory, for privacy reasons. | 286 // of in the system log directory, for privacy reasons. |
| 250 if (command_line.HasSwitch(chromeos::switches::kGuestSession)) | 287 if (command_line.HasSwitch(chromeos::switches::kGuestSession)) |
| 251 log_path = GetSessionLogFile(command_line); | 288 log_path = GetSessionLogFile(command_line); |
| 252 | 289 |
| 253 // On ChromeOS we log to the symlink. We force creation of a new | 290 // On ChromeOS we log to the symlink. We force creation of a new |
| 254 // symlink if we've been asked to delete the old log, since that | 291 // symlink if we've been asked to delete the old log, since that |
| 255 // indicates the start of a new session. | 292 // indicates the start of a new session. |
| 256 target_path = SetUpSymlinkIfNeeded( | 293 target_path = SetUpSymlinkIfNeeded( |
| 257 log_path, delete_old_log_file == DELETE_OLD_LOG_FILE); | 294 log_path, delete_old_log_file == logging::DELETE_OLD_LOG_FILE); |
| 258 | 295 |
| 259 // Because ChromeOS manages the move to a new session by redirecting | 296 // Because ChromeOS manages the move to a new session by redirecting |
| 260 // the link, it shouldn't remove the old file in the logging code, | 297 // the link, it shouldn't remove the old file in the logging code, |
| 261 // since that will remove the newly created link instead. | 298 // since that will remove the newly created link instead. |
| 262 delete_old_log_file = APPEND_TO_OLD_LOG_FILE; | 299 delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE; |
| 263 #endif | 300 #endif |
| 264 } else { | 301 } else { |
| 265 log_locking_state = DONT_LOCK_LOG_FILE; | 302 log_locking_state = DONT_LOCK_LOG_FILE; |
| 266 } | 303 } |
| 267 | 304 |
| 268 LoggingSettings settings; | 305 logging::LoggingSettings settings; |
| 269 settings.logging_dest = logging_dest; | 306 settings.logging_dest = logging_dest; |
| 270 settings.log_file = log_path.value().c_str(); | 307 settings.log_file = log_path.value().c_str(); |
| 271 settings.lock_log = log_locking_state; | 308 settings.lock_log = log_locking_state; |
| 272 settings.delete_old = delete_old_log_file; | 309 settings.delete_old = delete_old_log_file; |
| 273 bool success = InitLogging(settings); | 310 bool success = logging::InitLogging(settings); |
| 274 | 311 |
| 275 #if defined(OS_CHROMEOS) | 312 #if defined(OS_CHROMEOS) |
| 276 if (!success) { | 313 if (!success) { |
| 277 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value() | 314 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value() |
| 278 << " (which should be a link to " << target_path.value() << ")"; | 315 << " (which should be a link to " << target_path.value() << ")"; |
| 279 RemoveSymlinkAndLog(log_path, target_path); | 316 RemoveSymlinkAndLog(log_path, target_path); |
| 280 chrome_logging_failed_ = true; | 317 chrome_logging_failed_ = true; |
| 281 return; | 318 return; |
| 282 } | 319 } |
| 283 #else | 320 #else |
| 284 if (!success) { | 321 if (!success) { |
| 285 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); | 322 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); |
| 286 chrome_logging_failed_ = true; | 323 chrome_logging_failed_ = true; |
| 287 return; | 324 return; |
| 288 } | 325 } |
| 289 #endif | 326 #endif |
| 290 | 327 |
| 291 // Default to showing error dialogs. | 328 // Default to showing error dialogs. |
| 292 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 329 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 293 switches::kNoErrorDialogs)) | 330 switches::kNoErrorDialogs)) |
| 294 SetShowErrorDialogs(true); | 331 logging::SetShowErrorDialogs(true); |
| 295 | 332 |
| 296 // we want process and thread IDs because we have a lot of things running | 333 // we want process and thread IDs because we have a lot of things running |
| 297 SetLogItems(true, // enable_process_id | 334 logging::SetLogItems(true, // enable_process_id |
| 298 true, // enable_thread_id | 335 true, // enable_thread_id |
| 299 true, // enable_timestamp | 336 true, // enable_timestamp |
| 300 false); // enable_tickcount | 337 false); // enable_tickcount |
| 301 | 338 |
| 302 // We call running in unattended mode "headless", and allow | 339 // We call running in unattended mode "headless", and allow |
| 303 // headless mode to be configured either by the Environment | 340 // headless mode to be configured either by the Environment |
| 304 // Variable or by the Command Line Switch. This is for | 341 // Variable or by the Command Line Switch. This is for |
| 305 // automated test purposes. | 342 // automated test purposes. |
| 306 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 343 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 307 if (env->HasVar(env_vars::kHeadless) || | 344 if (env->HasVar(env_vars::kHeadless) || |
| 308 command_line.HasSwitch(switches::kNoErrorDialogs)) | 345 command_line.HasSwitch(switches::kNoErrorDialogs)) |
| 309 SuppressDialogs(); | 346 SuppressDialogs(); |
| 310 | 347 |
| 311 // Use a minimum log level if the command line asks for one. Ignore this | 348 // Use a minimum log level if the command line asks for one. Ignore this |
| 312 // switch if there's vlog level switch present too (as both of these switches | 349 // switch if there's vlog level switch present too (as both of these switches |
| 313 // refer to the same underlying log level, and the vlog level switch has | 350 // refer to the same underlying log level, and the vlog level switch has |
| 314 // already been processed inside InitLogging). If there is neither | 351 // already been processed inside logging::InitLogging). If there is neither |
| 315 // log level nor vlog level specified, then just leave the default level | 352 // log level nor vlog level specified, then just leave the default level |
| 316 // (INFO). | 353 // (INFO). |
| 317 if (command_line.HasSwitch(switches::kLoggingLevel) && | 354 if (command_line.HasSwitch(switches::kLoggingLevel) && |
| 318 GetMinLogLevel() >= 0) { | 355 logging::GetMinLogLevel() >= 0) { |
| 319 std::string log_level = | 356 std::string log_level = |
| 320 command_line.GetSwitchValueASCII(switches::kLoggingLevel); | 357 command_line.GetSwitchValueASCII(switches::kLoggingLevel); |
| 321 int level = 0; | 358 int level = 0; |
| 322 if (base::StringToInt(log_level, &level) && level >= 0 && | 359 if (base::StringToInt(log_level, &level) && level >= 0 && |
| 323 level < LOG_NUM_SEVERITIES) { | 360 level < LOG_NUM_SEVERITIES) { |
| 324 SetMinLogLevel(level); | 361 logging::SetMinLogLevel(level); |
| 325 } else { | 362 } else { |
| 326 DLOG(WARNING) << "Bad log level: " << log_level; | 363 DLOG(WARNING) << "Bad log level: " << log_level; |
| 327 } | 364 } |
| 328 } | 365 } |
| 329 | 366 |
| 330 #if defined(OS_WIN) | 367 #if defined(OS_WIN) |
| 331 // Enable trace control and transport through event tracing for Windows. | 368 // Enable trace control and transport through event tracing for Windows. |
| 332 LogEventProvider::Initialize(kChromeTraceProviderName); | 369 logging::LogEventProvider::Initialize(kChromeTraceProviderName); |
| 333 | 370 |
| 334 // Enable logging to the Windows Event Log. | 371 // Enable logging to the Windows Event Log. |
| 335 SetEventSourceName(base::UTF16ToASCII( | 372 logging::SetEventSourceName(base::UTF16ToASCII( |
| 336 install_static::InstallDetails::Get().install_full_name())); | 373 install_static::InstallDetails::Get().install_full_name())); |
| 337 #endif | 374 #endif |
| 338 | 375 |
| 339 base::StatisticsRecorder::InitLogOnShutdown(); | 376 base::StatisticsRecorder::InitLogOnShutdown(); |
| 340 | 377 |
| 341 chrome_logging_initialized_ = true; | 378 chrome_logging_initialized_ = true; |
| 342 } | 379 } |
| 343 | 380 |
| 344 // This is a no-op, but we'll keep it around in case | 381 // This is a no-op, but we'll keep it around in case |
| 345 // we need to do more cleanup in the future. | 382 // we need to do more cleanup in the future. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 time_deets.year, | 422 time_deets.year, |
| 386 time_deets.month, | 423 time_deets.month, |
| 387 time_deets.day_of_month, | 424 time_deets.day_of_month, |
| 388 time_deets.hour, | 425 time_deets.hour, |
| 389 time_deets.minute, | 426 time_deets.minute, |
| 390 time_deets.second); | 427 time_deets.second); |
| 391 return base_path.InsertBeforeExtensionASCII(suffix); | 428 return base_path.InsertBeforeExtensionASCII(suffix); |
| 392 } | 429 } |
| 393 | 430 |
| 394 } // namespace logging | 431 } // namespace logging |
| OLD | NEW |