rlog: rlog-novariadic.h Source File

Main Page | Modules | Class List | Directories | File List | Class Members | Related Pages

# rlog/rlog-novariadic.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 #include <stdarg.h> // for va_list
    00020 #include <stdio.h> // for NULL
    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