michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef CSFLOG_H michael@0: #define CSFLOG_H michael@0: michael@0: // In order for FORCE_PR_LOG below to work, we have to define it before the michael@0: // first time prlog is #included. michael@0: #if defined(PR_LOG) michael@0: #error "Must #include CSFLog.h before before any IPDL-generated files or other files that #include prlog.h." michael@0: #endif michael@0: michael@0: #if defined(MOZ_LOGGING) michael@0: #define FORCE_PR_LOG michael@0: #endif michael@0: michael@0: #include michael@0: #include "prlog.h" michael@0: michael@0: typedef enum{ michael@0: CSF_LOG_CRITICAL =1, michael@0: CSF_LOG_ERROR, michael@0: CSF_LOG_WARNING, michael@0: CSF_LOG_NOTICE, michael@0: CSF_LOG_INFO, michael@0: CSF_LOG_DEBUG, michael@0: CSF_LOG_OBNOXIOUS michael@0: } CSFLogLevel; michael@0: michael@0: michael@0: michael@0: #define CSFLogError(tag , format, ...) CSFLog( CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogErrorV(tag , format, va_list_arg) CSFLogV(CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: #define CSFLogWarn(tag , format, ...) CSFLog( CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogWarnV(tag , format, va_list_arg) CSFLogV(CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: #define CSFLogNotice(tag , format, ...) CSFLog( CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogNoticeV(tag , format, va_list_arg) CSFLogV(CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: #define CSFLogInfo(tag , format, ...) CSFLog( CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogInfoV(tag , format, va_list_arg) CSFLogV(CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: #define CSFLogDebug(tag , format, ...) CSFLog(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogDebugV(tag , format, va_list_arg) CSFLogV(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: #define CSFLogObnoxious(tag , format, ...) CSFLog(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) michael@0: #define CSFLogObnoxiousV(tag , format, va_list_arg) CSFLogV(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , va_list_arg ) michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" michael@0: { michael@0: #endif michael@0: void CSFLog( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...) michael@0: #ifdef __GNUC__ michael@0: __attribute__ ((format (printf, 5, 6))) michael@0: #endif michael@0: ; michael@0: void CSFLogV( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args); michael@0: michael@0: PRLogModuleInfo *GetSignalingLogInfo(); michael@0: PRLogModuleInfo *GetWebRTCLogInfo(); michael@0: extern int gWebrtcTraceLoggingOn; michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: #endif