summaryrefslogtreecommitdiffstats
path: root/base/logging.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/logging.cc')
-rw-r--r--base/logging.cc118
1 files changed, 62 insertions, 56 deletions
diff --git a/base/logging.cc b/base/logging.cc
index a736590..c38a2e0 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -64,7 +64,7 @@ typedef pthread_mutex_t* MutexHandle;
namespace logging {
-bool g_enable_dcheck = false;
+DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
VlogInfo* g_vlog_info = NULL;
const char* const log_severity_names[LOG_NUM_SEVERITIES] = {
@@ -353,15 +353,19 @@ bool InitializeLogFileHandle() {
bool BaseInitLoggingImpl(const PathChar* new_log_file,
LoggingDestination logging_dest,
LogLockingState lock_log,
+<<<<<<< HEAD
OldFileDeletionState delete_old) {
#ifdef ANDROID
// ifdef is here because we don't support parsing command line parameters
g_enable_dcheck = false;
g_vlog_info = NULL;
#else
+=======
+ OldFileDeletionState delete_old,
+ DcheckState dcheck_state) {
+>>>>>>> chromium.org at r11.0.672.0
CommandLine* command_line = CommandLine::ForCurrentProcess();
- g_enable_dcheck =
- command_line->HasSwitch(switches::kEnableDCHECK);
+ g_dcheck_state = dcheck_state;
delete g_vlog_info;
g_vlog_info = NULL;
// Don't bother initializing g_vlog_info unless we use one of the
@@ -536,71 +540,29 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
Init(file, line);
}
-LogMessage::LogMessage(const char* file, int line, const CheckOpString& result)
- : severity_(LOG_FATAL), file_(file), line_(line) {
+LogMessage::LogMessage(const char* file, int line)
+ : severity_(LOG_INFO), file_(file), line_(line) {
Init(file, line);
- stream_ << "Check failed: " << (*result.str_);
}
-LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
- const CheckOpString& result)
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
: severity_(severity), file_(file), line_(line) {
Init(file, line);
- stream_ << "Check failed: " << (*result.str_);
}
-LogMessage::LogMessage(const char* file, int line)
- : severity_(LOG_INFO), file_(file), line_(line) {
+LogMessage::LogMessage(const char* file, int line, std::string* result)
+ : severity_(LOG_FATAL), file_(file), line_(line) {
Init(file, line);
+ stream_ << "Check failed: " << *result;
+ delete result;
}
-LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ std::string* result)
: severity_(severity), file_(file), line_(line) {
Init(file, line);
-}
-
-// writes the common header info to the stream
-void LogMessage::Init(const char* file, int line) {
- base::StringPiece filename(file);
- size_t last_slash_pos = filename.find_last_of("\\/");
- if (last_slash_pos != base::StringPiece::npos)
- filename.remove_prefix(last_slash_pos + 1);
-
- // TODO(darin): It might be nice if the columns were fixed width.
-
- stream_ << '[';
- if (log_process_id)
- stream_ << CurrentProcessId() << ':';
- if (log_thread_id)
- stream_ << CurrentThreadId() << ':';
- if (log_timestamp) {
- time_t t = time(NULL);
- struct tm local_time = {0};
-#if _MSC_VER >= 1400
- localtime_s(&local_time, &t);
-#else
- localtime_r(&t, &local_time);
-#endif
- struct tm* tm_time = &local_time;
- stream_ << std::setfill('0')
- << std::setw(2) << 1 + tm_time->tm_mon
- << std::setw(2) << tm_time->tm_mday
- << '/'
- << std::setw(2) << tm_time->tm_hour
- << std::setw(2) << tm_time->tm_min
- << std::setw(2) << tm_time->tm_sec
- << ':';
- }
- if (log_tickcount)
- stream_ << TickCount() << ':';
- if (severity_ >= 0)
- stream_ << log_severity_names[severity_];
- else
- stream_ << "VERBOSE" << -severity_;
-
- stream_ << ":" << filename << "(" << line << ")] ";
-
- message_start_ = stream_.tellp();
+ stream_ << "Check failed: " << *result;
+ delete result;
}
LogMessage::~LogMessage() {
@@ -696,6 +658,50 @@ LogMessage::~LogMessage() {
}
}
+// writes the common header info to the stream
+void LogMessage::Init(const char* file, int line) {
+ base::StringPiece filename(file);
+ size_t last_slash_pos = filename.find_last_of("\\/");
+ if (last_slash_pos != base::StringPiece::npos)
+ filename.remove_prefix(last_slash_pos + 1);
+
+ // TODO(darin): It might be nice if the columns were fixed width.
+
+ stream_ << '[';
+ if (log_process_id)
+ stream_ << CurrentProcessId() << ':';
+ if (log_thread_id)
+ stream_ << CurrentThreadId() << ':';
+ if (log_timestamp) {
+ time_t t = time(NULL);
+ struct tm local_time = {0};
+#if _MSC_VER >= 1400
+ localtime_s(&local_time, &t);
+#else
+ localtime_r(&t, &local_time);
+#endif
+ struct tm* tm_time = &local_time;
+ stream_ << std::setfill('0')
+ << std::setw(2) << 1 + tm_time->tm_mon
+ << std::setw(2) << tm_time->tm_mday
+ << '/'
+ << std::setw(2) << tm_time->tm_hour
+ << std::setw(2) << tm_time->tm_min
+ << std::setw(2) << tm_time->tm_sec
+ << ':';
+ }
+ if (log_tickcount)
+ stream_ << TickCount() << ':';
+ if (severity_ >= 0)
+ stream_ << log_severity_names[severity_];
+ else
+ stream_ << "VERBOSE" << -severity_;
+
+ stream_ << ":" << filename << "(" << line << ")] ";
+
+ message_start_ = stream_.tellp();
+}
+
#if defined(OS_WIN)
// This has already been defined in the header, but defining it again as DWORD
// ensures that the type used in the header is equivalent to DWORD. If not,