|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef CSFLOG_H |
|
6 #define CSFLOG_H |
|
7 |
|
8 // In order for FORCE_PR_LOG below to work, we have to define it before the |
|
9 // first time prlog is #included. |
|
10 #if defined(PR_LOG) |
|
11 #error "Must #include CSFLog.h before before any IPDL-generated files or other files that #include prlog.h." |
|
12 #endif |
|
13 |
|
14 #if defined(MOZ_LOGGING) |
|
15 #define FORCE_PR_LOG |
|
16 #endif |
|
17 |
|
18 #include <stdarg.h> |
|
19 #include "prlog.h" |
|
20 |
|
21 typedef enum{ |
|
22 CSF_LOG_CRITICAL =1, |
|
23 CSF_LOG_ERROR, |
|
24 CSF_LOG_WARNING, |
|
25 CSF_LOG_NOTICE, |
|
26 CSF_LOG_INFO, |
|
27 CSF_LOG_DEBUG, |
|
28 CSF_LOG_OBNOXIOUS |
|
29 } CSFLogLevel; |
|
30 |
|
31 |
|
32 |
|
33 #define CSFLogError(tag , format, ...) CSFLog( CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
34 #define CSFLogErrorV(tag , format, va_list_arg) CSFLogV(CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
35 #define CSFLogWarn(tag , format, ...) CSFLog( CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
36 #define CSFLogWarnV(tag , format, va_list_arg) CSFLogV(CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
37 #define CSFLogNotice(tag , format, ...) CSFLog( CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
38 #define CSFLogNoticeV(tag , format, va_list_arg) CSFLogV(CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
39 #define CSFLogInfo(tag , format, ...) CSFLog( CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
40 #define CSFLogInfoV(tag , format, va_list_arg) CSFLogV(CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
41 #define CSFLogDebug(tag , format, ...) CSFLog(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
42 #define CSFLogDebugV(tag , format, va_list_arg) CSFLogV(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
43 #define CSFLogObnoxious(tag , format, ...) CSFLog(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) |
|
44 #define CSFLogObnoxiousV(tag , format, va_list_arg) CSFLogV(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , va_list_arg ) |
|
45 |
|
46 #ifdef __cplusplus |
|
47 extern "C" |
|
48 { |
|
49 #endif |
|
50 void CSFLog( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...) |
|
51 #ifdef __GNUC__ |
|
52 __attribute__ ((format (printf, 5, 6))) |
|
53 #endif |
|
54 ; |
|
55 void CSFLogV( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args); |
|
56 |
|
57 PRLogModuleInfo *GetSignalingLogInfo(); |
|
58 PRLogModuleInfo *GetWebRTCLogInfo(); |
|
59 extern int gWebrtcTraceLoggingOn; |
|
60 |
|
61 #ifdef __cplusplus |
|
62 } |
|
63 #endif |
|
64 |
|
65 #endif |