1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/signaling/src/common/browser_logging/CSFLog.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef CSFLOG_H 1.9 +#define CSFLOG_H 1.10 + 1.11 +// In order for FORCE_PR_LOG below to work, we have to define it before the 1.12 +// first time prlog is #included. 1.13 +#if defined(PR_LOG) 1.14 +#error "Must #include CSFLog.h before before any IPDL-generated files or other files that #include prlog.h." 1.15 +#endif 1.16 + 1.17 +#if defined(MOZ_LOGGING) 1.18 +#define FORCE_PR_LOG 1.19 +#endif 1.20 + 1.21 +#include <stdarg.h> 1.22 +#include "prlog.h" 1.23 + 1.24 +typedef enum{ 1.25 + CSF_LOG_CRITICAL =1, 1.26 + CSF_LOG_ERROR, 1.27 + CSF_LOG_WARNING, 1.28 + CSF_LOG_NOTICE, 1.29 + CSF_LOG_INFO, 1.30 + CSF_LOG_DEBUG, 1.31 + CSF_LOG_OBNOXIOUS 1.32 +} CSFLogLevel; 1.33 + 1.34 + 1.35 + 1.36 +#define CSFLogError(tag , format, ...) CSFLog( CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.37 +#define CSFLogErrorV(tag , format, va_list_arg) CSFLogV(CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.38 +#define CSFLogWarn(tag , format, ...) CSFLog( CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.39 +#define CSFLogWarnV(tag , format, va_list_arg) CSFLogV(CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.40 +#define CSFLogNotice(tag , format, ...) CSFLog( CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.41 +#define CSFLogNoticeV(tag , format, va_list_arg) CSFLogV(CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.42 +#define CSFLogInfo(tag , format, ...) CSFLog( CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.43 +#define CSFLogInfoV(tag , format, va_list_arg) CSFLogV(CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.44 +#define CSFLogDebug(tag , format, ...) CSFLog(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.45 +#define CSFLogDebugV(tag , format, va_list_arg) CSFLogV(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.46 +#define CSFLogObnoxious(tag , format, ...) CSFLog(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) 1.47 +#define CSFLogObnoxiousV(tag , format, va_list_arg) CSFLogV(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , va_list_arg ) 1.48 + 1.49 +#ifdef __cplusplus 1.50 +extern "C" 1.51 +{ 1.52 +#endif 1.53 +void CSFLog( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...) 1.54 +#ifdef __GNUC__ 1.55 + __attribute__ ((format (printf, 5, 6))) 1.56 +#endif 1.57 +; 1.58 +void CSFLogV( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args); 1.59 + 1.60 +PRLogModuleInfo *GetSignalingLogInfo(); 1.61 +PRLogModuleInfo *GetWebRTCLogInfo(); 1.62 +extern int gWebrtcTraceLoggingOn; 1.63 + 1.64 +#ifdef __cplusplus 1.65 +} 1.66 +#endif 1.67 + 1.68 +#endif