Remove all npapi plugins from windows metro chrome
[chromium-blink-merge.git] / base / mac / mac_logging.h
blobc463a35c9c8acef96f628f7d837f887405e2d8d2
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
3 // found in the LICENSE file.
5 #ifndef BASE_MAC_MAC_LOGGING_H_
6 #define BASE_MAC_MAC_LOGGING_H_
7 #pragma once
9 #include <libkern/OSTypes.h>
11 #include "base/logging.h"
13 // Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X
14 // system routines that report status via an OSStatus or OSErr value. It is
15 // similar to the PLOG family which operates on errno, but because there is no
16 // global (or thread-local) OSStatus or OSErr value, the specific error must
17 // be supplied as an argument to the OSSTATUS_LOG macro. The message logged
18 // will contain the symbolic constant name corresponding to the status value,
19 // along with the value itself.
21 // OSErr is just an older 16-bit form of the newer 32-bit OSStatus. Despite
22 // the name, OSSTATUS_LOG can be used equally well for OSStatus and OSErr.
24 namespace logging {
26 class BASE_EXPORT OSStatusLogMessage : public logging::LogMessage {
27 public:
28 OSStatusLogMessage(const char* file_path,
29 int line,
30 LogSeverity severity,
31 OSStatus status);
32 ~OSStatusLogMessage();
34 private:
35 OSStatus status_;
37 DISALLOW_COPY_AND_ASSIGN(OSStatusLogMessage);
40 } // namespace logging
42 #define OSSTATUS_LOG_STREAM(severity, status) \
43 COMPACT_GOOGLE_LOG_EX_ ## severity(OSStatusLogMessage, status).stream()
44 #define OSSTATUS_VLOG_STREAM(verbose_level, status) \
45 logging::OSStatusLogMessage(__FILE__, __LINE__, \
46 -verbose_level, status).stream()
48 #define OSSTATUS_LOG(severity, status) \
49 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), LOG_IS_ON(severity))
50 #define OSSTATUS_LOG_IF(severity, condition, status) \
51 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
52 LOG_IS_ON(severity) && (condition))
54 #define OSSTATUS_VLOG(verbose_level, status) \
55 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
56 VLOG_IS_ON(verbose_level))
57 #define OSSTATUS_VLOG_IF(verbose_level, condition, status) \
58 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
59 VLOG_IS_ON(verbose_level) && (condition))
61 #define OSSTATUS_CHECK(condition, status) \
62 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), !(condition)) \
63 << "Check failed: " # condition << ". "
65 #define OSSTATUS_DLOG(severity, status) \
66 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), DLOG_IS_ON(severity))
67 #define OSSTATUS_DLOG_IF(severity, condition, status) \
68 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
69 DLOG_IS_ON(severity) && (condition))
71 #define OSSTATUS_DVLOG(verbose_level, status) \
72 LAZY_STREAM(OSSTATUS_VPLOG_STREAM(verbose_level, status), \
73 DVLOG_IS_ON(verbose_level))
74 #define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \
75 LAZY_STREAM(OSSTATUS_VPLOG_STREAM(verbose_level, status) \
76 DVLOG_IS_ON(verbose_level) && (condition))
78 #define OSSTATUS_DCHECK(condition, status) \
79 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \
80 DCHECK_IS_ON() && !(condition)) \
81 << "Check failed: " # condition << ". "
83 #endif // BASE_MAC_MAC_LOGGING_H_