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 #ifndef BASE_MAC_MAC_LOGGING_H_ | 5 #ifndef BASE_MAC_MAC_LOGGING_H_ |
6 #define BASE_MAC_MAC_LOGGING_H_ | 6 #define BASE_MAC_MAC_LOGGING_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // global (or thread-local) OSStatus or OSErr value, the specific error must | 22 // global (or thread-local) OSStatus or OSErr value, the specific error must |
23 // be supplied as an argument to the OSSTATUS_LOG macro. The message logged | 23 // be supplied as an argument to the OSSTATUS_LOG macro. The message logged |
24 // will contain the symbolic constant name corresponding to the status value, | 24 // will contain the symbolic constant name corresponding to the status value, |
25 // along with the value itself. | 25 // along with the value itself. |
26 // | 26 // |
27 // OSErr is just an older 16-bit form of the newer 32-bit OSStatus. Despite | 27 // OSErr is just an older 16-bit form of the newer 32-bit OSStatus. Despite |
28 // the name, OSSTATUS_LOG can be used equally well for OSStatus and OSErr. | 28 // the name, OSSTATUS_LOG can be used equally well for OSStatus and OSErr. |
29 | 29 |
30 namespace logging { | 30 namespace logging { |
31 | 31 |
| 32 // Returns a UTF8 description from an OS X Status error. |
| 33 BASE_EXPORT std::string DescriptionFromOSStatus(OSStatus err); |
| 34 |
32 class BASE_EXPORT OSStatusLogMessage : public logging::LogMessage { | 35 class BASE_EXPORT OSStatusLogMessage : public logging::LogMessage { |
33 public: | 36 public: |
34 OSStatusLogMessage(const char* file_path, | 37 OSStatusLogMessage(const char* file_path, |
35 int line, | 38 int line, |
36 LogSeverity severity, | 39 LogSeverity severity, |
37 OSStatus status); | 40 OSStatus status); |
38 ~OSStatusLogMessage(); | 41 ~OSStatusLogMessage(); |
39 | 42 |
40 private: | 43 private: |
41 OSStatus status_; | 44 OSStatus status_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \ | 89 #define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \ |
87 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \ | 90 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \ |
88 MAC_DVLOG_IS_ON(verbose_level) && (condition)) | 91 MAC_DVLOG_IS_ON(verbose_level) && (condition)) |
89 | 92 |
90 #define OSSTATUS_DCHECK(condition, status) \ | 93 #define OSSTATUS_DCHECK(condition, status) \ |
91 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \ | 94 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \ |
92 DCHECK_IS_ON() && !(condition)) \ | 95 DCHECK_IS_ON() && !(condition)) \ |
93 << "Check failed: " #condition << ". " | 96 << "Check failed: " #condition << ". " |
94 | 97 |
95 #endif // BASE_MAC_MAC_LOGGING_H_ | 98 #endif // BASE_MAC_MAC_LOGGING_H_ |
OLD | NEW |