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

Side by Side Diff: chrome/common/logging_chrome.cc

Issue 6070006: Made logging not look up --enable-dcheck from command line (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed more compile failures Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 DCHECK(!chrome_logging_redirected_) << 209 DCHECK(!chrome_logging_redirected_) <<
210 "Attempted to redirect logging when it was already initialized."; 210 "Attempted to redirect logging when it was already initialized.";
211 211
212 // Redirect logs to the session log directory, if set. Otherwise 212 // Redirect logs to the session log directory, if set. Otherwise
213 // defaults to the profile dir. 213 // defaults to the profile dir.
214 FilePath log_path = GetSessionLogFile(command_line); 214 FilePath log_path = GetSessionLogFile(command_line);
215 215
216 // Always force a new symlink when redirecting. 216 // Always force a new symlink when redirecting.
217 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); 217 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true);
218 218
219 logging::DcheckState dcheck_state =
220 command_line.HasSwitch(switches::kEnableDCHECK) ?
221 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS :
222 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
223
219 // ChromeOS always logs through the symlink, so it shouldn't be 224 // ChromeOS always logs through the symlink, so it shouldn't be
220 // deleted if it already exists. 225 // deleted if it already exists.
221 if (!InitLogging(log_path.value().c_str(), 226 if (!InitLogging(log_path.value().c_str(),
222 DetermineLogMode(command_line), 227 DetermineLogMode(command_line),
223 logging::LOCK_LOG_FILE, 228 logging::LOCK_LOG_FILE,
224 logging::APPEND_TO_OLD_LOG_FILE)) { 229 logging::APPEND_TO_OLD_LOG_FILE,
230 dcheck_state)) {
225 LOG(ERROR) << "Unable to initialize logging to " << log_path.value(); 231 LOG(ERROR) << "Unable to initialize logging to " << log_path.value();
226 RemoveSymlinkAndLog(log_path, target_path); 232 RemoveSymlinkAndLog(log_path, target_path);
227 } else { 233 } else {
228 chrome_logging_redirected_ = true; 234 chrome_logging_redirected_ = true;
229 } 235 }
230 } 236 }
231 237
232 238
233 #endif 239 #endif
234 240
(...skipping 20 matching lines...) Expand all
255 // indicates the start of a new session. 261 // indicates the start of a new session.
256 FilePath target_path = SetUpSymlinkIfNeeded( 262 FilePath target_path = SetUpSymlinkIfNeeded(
257 log_path, delete_old_log_file == logging::DELETE_OLD_LOG_FILE); 263 log_path, delete_old_log_file == logging::DELETE_OLD_LOG_FILE);
258 264
259 // Because ChromeOS manages the move to a new session by redirecting 265 // 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, 266 // the link, it shouldn't remove the old file in the logging code,
261 // since that will remove the newly created link instead. 267 // since that will remove the newly created link instead.
262 delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE; 268 delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE;
263 #endif 269 #endif
264 270
271 logging::DcheckState dcheck_state =
272 command_line.HasSwitch(switches::kEnableDCHECK) ?
273 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS :
274 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
275
265 bool success = InitLogging(log_path.value().c_str(), 276 bool success = InitLogging(log_path.value().c_str(),
266 DetermineLogMode(command_line), 277 DetermineLogMode(command_line),
267 logging::LOCK_LOG_FILE, 278 logging::LOCK_LOG_FILE,
268 delete_old_log_file); 279 delete_old_log_file,
280 dcheck_state);
269 281
270 #if defined(OS_CHROMEOS) 282 #if defined(OS_CHROMEOS)
271 if (!success) { 283 if (!success) {
272 PLOG(ERROR) << "Unable to initialize logging to " << log_path.value() 284 PLOG(ERROR) << "Unable to initialize logging to " << log_path.value()
273 << " (which should be a link to " << target_path.value() << ")"; 285 << " (which should be a link to " << target_path.value() << ")";
274 RemoveSymlinkAndLog(log_path, target_path); 286 RemoveSymlinkAndLog(log_path, target_path);
275 return; 287 return;
276 } 288 }
277 #else 289 #else
278 if (!success) { 290 if (!success) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 assertions->push_back(wide_line); 396 assertions->push_back(wide_line);
385 ++assertion_count; 397 ++assertion_count;
386 } 398 }
387 } 399 }
388 log_file.close(); 400 log_file.close();
389 401
390 return assertion_count; 402 return assertion_count;
391 } 403 }
392 404
393 } // namespace logging 405 } // namespace logging
OLDNEW
« no previous file with comments | « chrome/browser/sync/tools/sync_listen_notifications.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698