00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <stdarg.h>
00020 #include <stdio.h>
00021
00022 class RLOG_DECL _rMessageProxy
00023 {
00024 public:
00025 _rMessageProxy( rlog::RLogChannel *channel, rlog::PublishLoc *loc );
00026
00027 void log(const char *format, ...) PRINTF(2,3);
00028 void log(rlog::RLogChannel *channel, const char *format, ...) PRINTF(3,4);
00029
00030 private:
00031 void doLog(const char *format, va_list ap);
00032
00033 rlog::PublishLoc *loc;
00034 };
00035
00036 #define _rMessageDef(ID, COMPONENT) \
00037 static rlog::PublishLoc ID ={&rlog::RLog_Register, 0, STR(COMPONENT), \
00038 __FILE__, __FUNCTION__, __LINE__, 0}
00039
00040 #define _rMessage(ID, CHANNEL, COMPONENT) \
00041 _rMessageDef(ID, COMPONENT); \
00042 _rMessageProxy(CHANNEL, &ID).log
00043
00044 #define rDebug _rMessage( LOGID, rlog::_RLDebugChannel, RLOG_COMPONENT )
00045 #define rInfo _rMessage( LOGID, rlog::_RLDebugChannel, RLOG_COMPONENT )
00046 #define rWarning _rMessage( LOGID, rlog::_RLWarningChannel, RLOG_COMPONENT )
00047 #define rError _rMessage( LOGID, rlog::_RLErrorChannel, RLOG_COMPONENT )
00048
00049 #define rLog _rMessage ( LOGID, NULL, RLOG_COMPONENT)
00050