# rlog-c99.h

    00001 /*****************************************************************************
    00002  * Author:   Valient Gough <vgough@pobox.com>
    00003  *
    00004  *****************************************************************************
    00005  * Copyright (c) 2002-2004, Valient Gough
    00006  *
    00007  * This library is free software; you can distribute it and/or modify it under
    00008  * the terms of the GNU Lesser General Public License (LGPL), as published by
    00009  * the Free Software Foundation; either version 2.1 of the License, or (at your
    00010  * option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful, but WITHOUT
    00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00014  * FITNESS FOR A PARTICULAR PURPOSE.  See the LGPL in the file COPYING for more
    00015  * details.
    00016  *
    00017  */
    00018
    00019
    00025 #define _rMessageDef(ID, COMPONENT) \
    00026   static rlog::PublishLoc ID ={&rlog::RLog_Register, 0, STR(COMPONENT), \
    00027       __FILE__, __FUNCTION__, __LINE__, 0};
    00028
    00033 #if HAVE_PRINTF_FP || !HAVE_PRINTF_ATTR
    00034 #  define _rMessageCall(ID, CHANNEL, ...) \
    00035   if(unlikely(ID.publish!=0)) (*ID.publish)( &ID, CHANNEL, ##__VA_ARGS__ );
    00036 #else // no PRINTF attributes..
    00037 # define _rMessageCall(ID, CHANNEL, ...) \
    00038   if(unlikely(ID.publish!=0))  \
    00039   { \
    00040     (*ID.publish)( &ID, CHANNEL, ##__VA_ARGS__ ); \
    00041     rlog::__checkArgs( 0, ##__VA_ARGS__ ); \
    00042   }
    00043 #endif
    00044
    00054 #define _rMessage(ID, CHANNEL, ... ) \
    00055   do { _rMessageDef(ID, RLOG_COMPONENT) \
    00056        _rMessageCall(ID, CHANNEL, ##__VA_ARGS__ ) } while(0)
    00057
    00082 #define rDebug(...) \
    00083   _rMessage( LOGID, rlog::_RLDebugChannel, ##__VA_ARGS__ )
    00084
    00098 #define rInfo(...) \
    00099   _rMessage( LOGID, rlog::_RLInfoChannel, ##__VA_ARGS__ )
    00100
    00118 #define rWarning(...) \
    00119   _rMessage( LOGID, rlog::_RLWarningChannel, ##__VA_ARGS__ )
    00120
    00136 #define rError(...) \
    00137   _rMessage( LOGID, rlog::_RLErrorChannel, ##__VA_ARGS__ )
    00138
    00156 #define rLog(channel, ...) \
    00157   _rMessage( LOGID, channel, ##__VA_ARGS__ )
    00158
    00159