| OLD | NEW |
| 1 // Copyright 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright 2006-2008 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/time.h> | 9 #include <sys/time.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 LogMessage::~LogMessage() { | 55 LogMessage::~LogMessage() { |
| 56 stream_ << std::endl; | 56 stream_ << std::endl; |
| 57 std::string str_newline(stream_.str()); | 57 std::string str_newline(stream_.str()); |
| 58 fprintf(stderr, "%s", str_newline.c_str()); | 58 fprintf(stderr, "%s", str_newline.c_str()); |
| 59 fflush(stderr); | 59 fflush(stderr); |
| 60 if (severity_ == LOG_FATAL) { | 60 if (severity_ == LOG_FATAL) { |
| 61 #ifndef NDEBUG | 61 #ifndef NDEBUG |
| 62 abort(); | 62 abort(); |
| 63 #else | 63 #else |
| 64 #if defined(OS_WIN) |
| 65 __debugbreak(); |
| 66 #else |
| 64 __asm__("int3"); | 67 __asm__("int3"); |
| 65 #endif | 68 #endif |
| 69 #endif |
| 66 } | 70 } |
| 67 } | 71 } |
| 68 | 72 |
| 69 void LogMessage::Init(const char* function, | 73 void LogMessage::Init(const char* function, |
| 70 const std::string& file_path, | 74 const std::string& file_path, |
| 71 int line) { | 75 int line) { |
| 72 std::string file_name; | 76 std::string file_name; |
| 73 size_t last_slash = file_path.find_last_of('/'); | 77 size_t last_slash = file_path.find_last_of('/'); |
| 74 if (last_slash != std::string::npos) { | 78 if (last_slash != std::string::npos) { |
| 75 file_name.assign(file_path.substr(last_slash + 1)); | 79 file_name.assign(file_path.substr(last_slash + 1)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 135 |
| 132 ErrnoLogMessage::~ErrnoLogMessage() { | 136 ErrnoLogMessage::~ErrnoLogMessage() { |
| 133 stream() << ": " | 137 stream() << ": " |
| 134 << safe_strerror(err_) | 138 << safe_strerror(err_) |
| 135 << " (" | 139 << " (" |
| 136 << err_ | 140 << err_ |
| 137 << ")"; | 141 << ")"; |
| 138 } | 142 } |
| 139 | 143 |
| 140 } // namespace logging | 144 } // namespace logging |
| OLD | NEW |