OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
12 | 12 |
| 13 #import "webrtc/base/objc/RTCMacros.h" |
| 14 |
13 // Subset of rtc::LoggingSeverity. | 15 // Subset of rtc::LoggingSeverity. |
14 typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { | 16 typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { |
15 RTCLoggingSeverityVerbose, | 17 RTCLoggingSeverityVerbose, |
16 RTCLoggingSeverityInfo, | 18 RTCLoggingSeverityInfo, |
17 RTCLoggingSeverityWarning, | 19 RTCLoggingSeverityWarning, |
18 RTCLoggingSeverityError, | 20 RTCLoggingSeverityError, |
19 }; | 21 }; |
20 | 22 |
21 #if defined(__cplusplus) | |
22 extern "C" void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); | |
23 extern "C" void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); | |
24 extern "C" NSString* RTCFileName(const char* filePath); | |
25 #else | |
26 | |
27 // Wrapper for C++ LOG(sev) macros. | 23 // Wrapper for C++ LOG(sev) macros. |
28 // Logs the log string to the webrtc logstream for the given severity. | 24 // Logs the log string to the webrtc logstream for the given severity. |
29 extern void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); | 25 RTC_EXTERN void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); |
30 | 26 |
31 // Wrapper for rtc::LogMessage::LogToDebug. | 27 // Wrapper for rtc::LogMessage::LogToDebug. |
32 // Sets the minimum severity to be logged to console. | 28 // Sets the minimum severity to be logged to console. |
33 extern void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); | 29 RTC_EXTERN void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); |
34 | 30 |
35 // Returns the filename with the path prefix removed. | 31 // Returns the filename with the path prefix removed. |
36 extern NSString* RTCFileName(const char* filePath); | 32 RTC_EXTERN NSString* RTCFileName(const char* filePath); |
37 | |
38 #endif | |
39 | 33 |
40 // Some convenience macros. | 34 // Some convenience macros. |
41 | 35 |
42 #define RTCLogString(format, ...) \ | 36 #define RTCLogString(format, ...) \ |
43 [NSString stringWithFormat:@"(%@:%d %s): " format, \ | 37 [NSString stringWithFormat:@"(%@:%d %s): " format, \ |
44 RTCFileName(__FILE__), \ | 38 RTCFileName(__FILE__), \ |
45 __LINE__, \ | 39 __LINE__, \ |
46 __FUNCTION__, \ | 40 __FUNCTION__, \ |
47 ##__VA_ARGS__] | 41 ##__VA_ARGS__] |
48 | 42 |
(...skipping 17 matching lines...) Expand all Loading... |
66 | 60 |
67 #if !defined(NDEBUG) | 61 #if !defined(NDEBUG) |
68 #define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) | 62 #define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) |
69 #else | 63 #else |
70 #define RTCLogDebug(format, ...) \ | 64 #define RTCLogDebug(format, ...) \ |
71 do { \ | 65 do { \ |
72 } while (false) | 66 } while (false) |
73 #endif | 67 #endif |
74 | 68 |
75 #define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) | 69 #define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) |
OLD | NEW |