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 _rMessageProxy
00023 {
00024
public:
00025 _rMessageProxy(
rlog::RLogChannel *channel,
00026
rlog::PublishLoc *loc )
00027 {
00028 this->loc = loc;
00029 loc->
channel = channel;
00030 }
00031
00032
void log(
const char *format, ...) PRINTF(2,3);
00033
void log(rlog::
RLogChannel *channel, const
char *format, ...) PRINTF(3,4);
00034
00035 private:
00036 rlog::PublishLoc *loc;
00037 };
00038
00039 #define _rMessageDef(ID, COMPONENT) \
00040 static rlog::PublishLoc ID ={&rlog::RLog_Register, 0, STR(COMPONENT), \
00041 __FILE__, __FUNCTION__, __LINE__, 0}
00042
00043
#define _rMessage(ID, CHANNEL, COMPONENT) \
00044
_rMessageDef(ID, COMPONENT); \
00045
_rMessageProxy(CHANNEL, &ID).log
00046
00047
#define rDebug _rMessage( LOGID, rlog::_RLDebugChannel, RLOG_COMPONENT )
00048
#define rInfo _rMessage( LOGID, rlog::_RLDebugChannel, RLOG_COMPONENT )
00049
#define rWarning _rMessage( LOGID, rlog::_RLWarningChannel, RLOG_COMPONENT )
00050
#define rError _rMessage( LOGID, rlog::_RLErrorChannel, RLOG_COMPONENT )
00051
00052
#define rLog _rMessage ( LOGID, NULL, RLOG_COMPONENT)
00053