Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

loggingmacros.h

Go to the documentation of this file.
00001 // Module:  Log4CPLUS
00002 // File:    loggingmacros.h
00003 // Created: 8/2003
00004 // Author:  Tad E. Smith
00005 //
00006 //
00007 // Copyright (C) Tad E. Smith  All rights reserved.
00008 //
00009 // This software is published under the terms of the Apache Software
00010 // License version 1.1, a copy of which has been included with this
00011 // distribution in the LICENSE.APL file.
00012 //
00013 
00017 #ifndef _LOG4CPLUS_LOGGING_MACROS_HEADER_
00018 #define _LOG4CPLUS_LOGGING_MACROS_HEADER_
00019 
00020 #if defined(LOG4CPLUS_DISABLE_FATAL) && !defined(LOG4CPLUS_DISABLE_ERROR)
00021 #define LOG4CPLUS_DISABLE_ERROR
00022 #endif
00023 #if defined(LOG4CPLUS_DISABLE_ERROR) && !defined(LOG4CPLUS_DISABLE_WARN)
00024 #define LOG4CPLUS_DISABLE_WARN
00025 #endif
00026 #if defined(LOG4CPLUS_DISABLE_WARN) && !defined(LOG4CPLUS_DISABLE_INFO)
00027 #define LOG4CPLUS_DISABLE_INFO
00028 #endif
00029 #if defined(LOG4CPLUS_DISABLE_INFO) && !defined(LOG4CPLUS_DISABLE_DEBUG)
00030 #define LOG4CPLUS_DISABLE_DEBUG
00031 #endif
00032 #if defined(LOG4CPLUS_DISABLE_DEBUG) && !defined(LOG4CPLUS_DISABLE_TRACE)
00033 #define LOG4CPLUS_DISABLE_TRACE
00034 #endif
00035 
00036 
00043 #if !defined(LOG4CPLUS_DISABLE_TRACE)
00044 #define LOG4CPLUS_TRACE_METHOD(logger, logEvent) \
00045     log4cplus::TraceLogger _log4cplus_trace_logger(logger, logEvent, __FILE__, __LINE__);
00046 #define LOG4CPLUS_TRACE(logger, logEvent) \
00047     do { \
00048         if(logger.isEnabledFor(log4cplus::TRACE_LOG_LEVEL)) { \
00049             log4cplus::tostringstream _log4cplus_buf; \
00050             _log4cplus_buf << logEvent; \
00051             logger.forcedLog(log4cplus::TRACE_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00052         } \
00053     } while(0);
00054 #define LOG4CPLUS_TRACE_STR(logger, logEvent) \
00055     do { \
00056         if(logger.isEnabledFor(log4cplus::TRACE_LOG_LEVEL)) { \
00057             logger.forcedLog(log4cplus::TRACE_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00058         } \
00059     } while(0);
00060 #else
00061 #define LOG4CPLUS_TRACE_METHOD(logger, logEvent)
00062 #define LOG4CPLUS_TRACE(logger, logEvent)
00063 #define LOG4CPLUS_TRACE_STR(logger, logEvent)
00064 #endif
00065 
00071 #if !defined(LOG4CPLUS_DISABLE_DEBUG)
00072 #define LOG4CPLUS_DEBUG(logger, logEvent) \
00073     do { \
00074         if(logger.isEnabledFor(log4cplus::DEBUG_LOG_LEVEL)) { \
00075             log4cplus::tostringstream _log4cplus_buf; \
00076             _log4cplus_buf << logEvent; \
00077             logger.forcedLog(log4cplus::DEBUG_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00078         } \
00079     } while(0);
00080 #define LOG4CPLUS_DEBUG_STR(logger, logEvent) \
00081     do { \
00082         if(logger.isEnabledFor(log4cplus::DEBUG_LOG_LEVEL)) { \
00083             logger.forcedLog(log4cplus::DEBUG_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00084         } \
00085     } while(0);
00086 #else
00087 #define LOG4CPLUS_DEBUG(logger, logEvent) 
00088 #define LOG4CPLUS_DEBUG_STR(logger, logEvent)
00089 #endif
00090 
00096 #if !defined(LOG4CPLUS_DISABLE_INFO)
00097 #define LOG4CPLUS_INFO(logger, logEvent) \
00098     do { \
00099         if(logger.isEnabledFor(log4cplus::INFO_LOG_LEVEL)) { \
00100             log4cplus::tostringstream _log4cplus_buf; \
00101             _log4cplus_buf << logEvent; \
00102             logger.forcedLog(log4cplus::INFO_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00103         } \
00104     } while(0);
00105 #define LOG4CPLUS_INFO_STR(logger, logEvent) \
00106     do { \
00107         if(logger.isEnabledFor(log4cplus::INFO_LOG_LEVEL)) { \
00108             logger.forcedLog(log4cplus::INFO_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00109         } \
00110     } while(0);
00111 #else
00112 #define LOG4CPLUS_INFO(logger, logEvent)
00113 #define LOG4CPLUS_INFO_STR(logger, logEvent)
00114 #endif
00115 
00121 #if !defined(LOG4CPLUS_DISABLE_WARN)
00122 #define LOG4CPLUS_WARN(logger, logEvent) \
00123     do { \
00124         if(logger.isEnabledFor(log4cplus::WARN_LOG_LEVEL)) { \
00125             log4cplus::tostringstream _log4cplus_buf; \
00126             _log4cplus_buf << logEvent; \
00127             logger.forcedLog(log4cplus::WARN_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00128         } \
00129     } while(0);
00130 #define LOG4CPLUS_WARN_STR(logger, logEvent) \
00131     do { \
00132         if(logger.isEnabledFor(log4cplus::WARN_LOG_LEVEL)) { \
00133             logger.forcedLog(log4cplus::WARN_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00134         } \
00135     } while(0);
00136 #else
00137 #define LOG4CPLUS_WARN(logger, logEvent)
00138 #define LOG4CPLUS_WARN_STR(logger, logEvent)
00139 #endif
00140 
00146 #if !defined(LOG4CPLUS_DISABLE_ERROR)
00147 #define LOG4CPLUS_ERROR(logger, logEvent) \
00148     do { \
00149         if(logger.isEnabledFor(log4cplus::ERROR_LOG_LEVEL)) { \
00150             log4cplus::tostringstream _log4cplus_buf; \
00151             _log4cplus_buf << logEvent; \
00152             logger.forcedLog(log4cplus::ERROR_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00153         } \
00154     } while(0);
00155 #define LOG4CPLUS_ERROR_STR(logger, logEvent) \
00156     do { \
00157         if(logger.isEnabledFor(log4cplus::ERROR_LOG_LEVEL)) { \
00158             logger.forcedLog(log4cplus::ERROR_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00159         } \
00160     } while(0);
00161 #else
00162 #define LOG4CPLUS_ERROR(logger, logEvent)
00163 #define LOG4CPLUS_ERROR_STR(logger, logEvent)
00164 #endif
00165 
00171 #if !defined(LOG4CPLUS_DISABLE_FATAL)
00172 #define LOG4CPLUS_FATAL(logger, logEvent) \
00173     do { \
00174         if(logger.isEnabledFor(log4cplus::FATAL_LOG_LEVEL)) { \
00175             log4cplus::tostringstream _log4cplus_buf; \
00176             _log4cplus_buf << logEvent; \
00177             logger.forcedLog(log4cplus::FATAL_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
00178         } \
00179     } while(0);
00180 #define LOG4CPLUS_FATAL_STR(logger, logEvent) \
00181     do { \
00182         if(logger.isEnabledFor(log4cplus::FATAL_LOG_LEVEL)) { \
00183             logger.forcedLog(log4cplus::FATAL_LOG_LEVEL, logEvent, __FILE__, __LINE__); \
00184         } \
00185     } while(0);
00186 #else
00187 #define LOG4CPLUS_FATAL(logger, logEvent)
00188 #define LOG4CPLUS_FATAL_STR(logger, logEvent) 
00189 #endif
00190 
00191 #endif /* _LOG4CPLUS_LOGGING_MACROS_HEADER_ */
00192 

Generated on Mon Feb 9 09:10:30 2004 for log4cplus by doxygen 1.3.2