GNU Radio 3.6.5 C++ API

gr_logger.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2012-2013 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 /*******************************************************************************
00024 * Author: Mark Plett
00025 * Description:
00026 *   The gr_logger module wraps the log4cpp library for logging in gnuradio
00027 *******************************************************************************/
00028 
00029 #ifndef INCLUDED_GR_LOGGER_H
00030 #define INCLUDED_GR_LOGGER_H
00031 
00032 /*!
00033 * \file gr_logger.h
00034 * \ingroup logging
00035 * \brief GNURADIO logging wrapper for log4cpp library (C++ port of log4j)
00036 *
00037 */
00038 
00039 #include <gr_core_api.h>
00040 #include <assert.h>
00041 #include <iostream>
00042 #include <boost/format.hpp>
00043 
00044 #ifdef ENABLE_GR_LOG
00045 
00046 // We have three configurations... first logging to stdout/stderr
00047 #ifndef HAVE_LOG4CPP
00048 //#warning GR logging Enabled and using std::cout
00049 
00050 typedef std::string gr_logger_ptr;
00051 
00052 #define GR_LOG_DECLARE_LOGPTR(logger)
00053 #define GR_LOG_ASSIGN_LOGPTR(logger,name)
00054 #define GR_CONFIG_LOGGER(config)
00055 #define GR_CONFIG_AND_WATCH_LOGGER(config,period)
00056 #define GR_LOG_GETLOGGER(logger, name) 
00057 #define GR_SET_LEVEL(name, level)
00058 #define GR_LOG_SET_LEVEL(logger, level) 
00059 #define GR_GET_LEVEL(name, level)
00060 #define GR_LOG_GET_LEVEL(logger, level)
00061 #define GR_ADD_CONSOLE_APPENDER(logger,target,pattern)
00062 #define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern)
00063 #define GR_ADD_FILE_APPENDER(name,filename,append,pattern)
00064 #define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern)
00065 #define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern)
00066 #define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern)
00067 #define GR_GET_LOGGER_NAMES(names)
00068 #define GR_RESET_CONFIGURATION()
00069 #define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl
00070 #define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl
00071 #define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl
00072 #define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl
00073 #define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
00074 #define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
00075 #define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl
00076 #define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl
00077 #define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl
00078 #define GR_ERRORIF(name, cond, msg) if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl
00079 #define GR_ASSERT(name, cond, msg) if(!(cond)) std::cerr<<"ERROR: "<<msg<<std::endl; assert(cond)
00080 #define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl
00081 #define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl
00082 #define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl
00083 #define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl
00084 #define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl
00085 #define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl
00086 #define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl
00087 #define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl
00088 #define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl
00089 #define GR_LOG_ERRORIF(logger, cond, msg) if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl
00090 #define GR_LOG_ASSERT(logger, cond, msg) std::cerr<<"ERROR: "<<msg<<std::endl; assert(cond)
00091 
00092 #else /* HAVE_LOG4CPP */
00093 // Second configuration...logging to log4cpp
00094 
00095 #include <log4cpp/Category.hh>
00096 #include <log4cpp/PropertyConfigurator.hh>
00097 #include <log4cpp/FileAppender.hh>
00098 #include <log4cpp/RollingFileAppender.hh>
00099 #include <log4cpp/OstreamAppender.hh>
00100 #include <log4cpp/PatternLayout.hh>
00101 
00102 /*!
00103  * \brief GR_LOG macros
00104  * \ingroup logging
00105  *
00106  * These macros wrap the standard LOG4CPP_LEVEL macros.  The availablie macros
00107  * are:
00108  *  GR_LOG_DEBUG
00109  *  GR_LOG_INFO
00110  *  GR_LOG_WARN
00111  *  GR_LOG_TRACE
00112  *  GR_LOG_ERROR
00113  *  GR_LOG_ALERT
00114  *  GR_LOG_CRIT
00115  *  GR_LOG_FATAL
00116  *  GR_LOG_EMERG
00117  */
00118 typedef log4cpp::Category* gr_logger_ptr;
00119 
00120 /* Macros for Programmatic Configuration */
00121 #define GR_LOG_DECLARE_LOGPTR(logger) \
00122   gr_logger_ptr logger;
00123 
00124 #define GR_LOG_ASSIGN_LOGPTR(logger,name) \
00125   logger = gr_logger::getLogger(name);
00126 
00127 #define GR_CONFIG_LOGGER(config)        \
00128   logger_load_config(config)
00129 
00130 #define GR_CONFIG_AND_WATCH_LOGGER(config,period)       \
00131   logger_load_config_and_watch(config,period)
00132 
00133 #define GR_LOG_GETLOGGER(logger, name) \
00134   gr_logger_ptr logger = gr_logger::getLogger(name);
00135 
00136 #define GR_SET_LEVEL(name, level){ \
00137   gr_logger_ptr logger = gr_logger::getLogger(name);\
00138   logger_set_level(logger,level);}
00139 
00140 #define GR_LOG_SET_LEVEL(logger, level) \
00141   logger_set_level(logger, level);
00142 
00143 #define GR_GET_LEVEL(name, level){ \
00144   gr_logger_ptr logger = gr_logger::getLogger(name);\
00145   logger_get_level(logger,level);}
00146 
00147 #define GR_LOG_GET_LEVEL(logger, level) \
00148   logger_get_level(logger,level);
00149 
00150 #define GR_ADD_CONSOLE_APPENDER(name,target,pattern){\
00151   gr_logger_ptr logger = gr_logger::getLogger(name);\
00152   logger_add_console_appender(logger,target,pattern);}
00153 
00154 #define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern){\
00155   logger_add_console_appender(logger,target,pattern);}
00156 
00157 #define GR_ADD_FILE_APPENDER(name,filename,append,pattern){\
00158   gr_logger_ptr logger = gr_logger::getLogger(name);\
00159   logger_add_file_appender(logger,filename,append,pattern);}
00160 
00161 #define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern){\
00162   logger_add_file_appender(logger,filename,append,pattern);}
00163 
00164 #define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern){\
00165   gr_logger_ptr logger = gr_logger::getLogger(name);\
00166   logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);}
00167 
00168 #define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern){\
00169   logger_add_rollingfile_appender(logger,filename,filesize,bkup_index,append,mode,pattern);}
00170 
00171 #define GR_GET_LOGGER_NAMES(names){ \
00172   logger_get_logger_names(names);}
00173 
00174 #define GR_RESET_CONFIGURATION(){ \
00175   logger_reset_config();}
00176 
00177 /* Logger name referenced macros */
00178 #define GR_DEBUG(name, msg) { \
00179   gr_logger_ptr logger = gr_logger::getLogger(name);\
00180   *logger<< log4cpp::Priority::DEBUG << msg << log4cpp::eol;}
00181 
00182 #define GR_INFO(name, msg) { \
00183   gr_logger_ptr logger = gr_logger::getLogger(name);\
00184   *logger<< log4cpp::Priority::INFO << msg << log4cpp::eol;}
00185 
00186 #define GR_NOTICE(name, msg) { \
00187   gr_logger_ptr logger = gr_logger::getLogger(name);\
00188   *logger << log4cpp::Priority::NOTICE << msg;}
00189 
00190 #define GR_WARN(name, msg) { \
00191   gr_logger_ptr logger = gr_logger::getLogger(name);\
00192   *logger<< log4cpp::Priority::WARN << msg << log4cpp::eol;}
00193 
00194 #define GR_ERROR(name, msg) { \
00195   gr_logger_ptr logger = gr_logger::getLogger(name);\
00196   *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;}
00197 
00198 #define GR_CRIT(name, msg) { \
00199   gr_logger_ptr logger = gr_logger::getLogger(name);\
00200   *logger<< log4cpp::Priority::CRIT << msg << log4cpp::eol;}
00201 
00202 #define GR_ALERT(name, msg) { \
00203   gr_logger_ptr logger = gr_logger::getLogger(name);\
00204   *logger<< log4cpp::Priority::ALERT << msg << log4cpp::eol;}
00205 
00206 #define GR_FATAL(name, msg) { \
00207   gr_logger_ptr logger = gr_logger::getLogger(name);\
00208   *logger<< log4cpp::Priority::FATAL << msg << log4cpp::eol;}
00209 
00210 #define GR_EMERG(name, msg) { \
00211   gr_logger_ptr logger = gr_logger::getLogger(name);\
00212   *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;}
00213 
00214 #define GR_ERRORIF(name, cond, msg) { \
00215 if((cond)){\
00216   gr_logger_ptr logger = gr_logger::getLogger(name);\
00217   *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;};\
00218 };
00219 
00220 #define GR_ASSERT(name, cond, msg) { \
00221 if((!cond)){\
00222     gr_logger_ptr logger = gr_logger::getLogger(name);\
00223     *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;};\
00224     assert(0);\
00225 };
00226 
00227 /* LoggerPtr Referenced Macros */
00228 #define GR_LOG_DEBUG(logger, msg) { \
00229   *logger << log4cpp::Priority::DEBUG << msg << log4cpp::eol;}
00230 
00231 #define GR_LOG_INFO(logger, msg) { \
00232   *logger << log4cpp::Priority::INFO << msg << log4cpp::eol;}
00233 
00234 #define GR_LOG_NOTICE(logger, msg) { \
00235   *logger << log4cpp::Priority::NOTICE << msg << log4cpp::eol;}
00236 
00237 #define GR_LOG_WARN(logger, msg) { \
00238   *logger << log4cpp::Priority::WARN << msg << log4cpp::eol;}
00239 
00240 #define GR_LOG_ERROR(logger, msg) { \
00241   *logger << log4cpp::Priority::ERROR << msg << log4cpp::eol;}
00242 
00243 #define GR_LOG_CRIT(logger, msg) { \
00244   *logger << log4cpp::Priority::CRIT << msg << log4cpp::eol;}
00245 
00246 #define GR_LOG_ALERT(logger, msg) { \
00247   *logger << log4cpp::Priority::ALERT << msg << log4cpp::eol;}
00248 
00249 #define GR_LOG_FATAL(logger, msg) { \
00250   *logger << log4cpp::Priority::FATAL << msg << log4cpp::eol;}
00251 
00252 #define GR_LOG_EMERG(logger, msg) { \
00253   *logger << log4cpp::Priority::EMERG << msg << log4cpp::eol;}
00254 
00255 #define GR_LOG_ERRORIF(logger,cond, msg) { \
00256 if((!cond)){\
00257     *logger<< log4cpp::Priority::ERROR << msg << log4cpp::eol;};\
00258     assert(0);\
00259 };
00260 
00261 #define GR_LOG_ASSERT(logger, cond, msg) { \
00262 if((!cond)){\
00263     *logger<< log4cpp::Priority::EMERG << msg << log4cpp::eol;};\
00264     assert(0);\
00265 };
00266 
00267 /*!
00268  * \brief Load logger's configuration file.
00269  *
00270  * Initialize the GNU Radio logger by loading the configuration file
00271  * \p config_filename.
00272  *
00273  * \param config_filename The configuration file. Set to "" for the
00274  *        basic logger that outputs to the console.
00275  */
00276 GR_CORE_API void logger_load_config(const std::string &config_filename="");
00277 
00278 
00279 GR_CORE_API void logger_load_config_and_watch(const std::string &config_filename,
00280                                               unsigned int watch_period);
00281 
00282 GR_CORE_API void logger_reset_config(void);
00283 
00284 /*!
00285  * \brief Set the logger's output level.
00286  *
00287  * Sets the level of the logger. This takes a string that is
00288  * translated to the standard levels and can be (case insensitive):
00289  *
00290  * \li off , notset
00291  * \li debug
00292  * \li info
00293  * \li notice
00294  * \li warn
00295  * \li error
00296  * \li crit
00297  * \li alert
00298  * \li fatal
00299  * \li emerg
00300  *
00301  * \param logger the logger to set the level of.
00302  * \param level  string to set the level to.
00303  */
00304 GR_CORE_API void logger_set_level(gr_logger_ptr logger, const std::string &level);
00305 
00306 /*!
00307  * \brief Set the logger's output level.
00308  *
00309  * Sets the level of the logger. This takes the actual Log4cpp::Priority
00310  * data type, which can be:
00311  *
00312  * \li log4cpp::Priority::NOTSET
00313  * \li log4cpp::Priority::DEBUG
00314  * \li log4cpp::Priority::INFO
00315  * \li log4cpp::Priority::NOTICE
00316  * \li log4cpp::Priority::WARN
00317  * \li log4cpp::Priority::ERROR
00318  * \li log4cpp::Priority::CRIT
00319  * \li log4cpp::Priority::ALERT
00320  * \li log4cpp::Priority::FATAL
00321  * \li log4cpp::Priority::EMERG
00322  *
00323  * \param logger the logger to set the level of.
00324  * \param level  new logger level of type Log4cpp::Priority
00325  */
00326 void logger_set_level(gr_logger_ptr logger, log4cpp::Priority::Value level);
00327 
00328 
00329 /*!
00330  * \brief Get the logger's output level.
00331  *
00332  * Gets the level of the logger. This returns a string that
00333  * corresponds to the standard levels and can be (case insensitive):
00334  *
00335  * \li notset
00336  * \li debug
00337  * \li info
00338  * \li notice
00339  * \li warn
00340  * \li error
00341  * \li crit
00342  * \li alert
00343  * \li fatal
00344  * \li emerg
00345  *
00346  * \param logger the logger to get the level of.
00347  * \param level  string to get the level into.
00348  */
00349 GR_CORE_API void logger_get_level(gr_logger_ptr logger, std::string &level);
00350 
00351 /*!
00352  * \brief Get the logger's output level.
00353  *
00354  * Gets the level of the logger. This returns the actual Log4cpp::Level
00355  * data type, which can be:
00356  *
00357  * \li log4cpp::Priority::NOTSET
00358  * \li log4cpp::Priority::DEBUG
00359  * \li log4cpp::Priority::INFO
00360  * \li log4cpp::Priority::NOTICE
00361  * \li log4cpp::Priority::WARN
00362  * \li log4cpp::Priority::ERROR
00363  * \li log4cpp::Priority::CRIT
00364  * \li log4cpp::Priority::ALERT
00365  * \li log4cpp::Priority::FATAL
00366  * \li log4cpp::Priority::EMERG
00367  *
00368  * \param logger the logger to get the level of.
00369  * \param level of the logger.
00370  */
00371 GR_CORE_API void logger_get_level(gr_logger_ptr logger, log4cpp::Priority::Value &level);
00372 
00373 GR_CORE_API void logger_add_console_appender(gr_logger_ptr logger,std::string target,std::string pattern);
00374 
00375 GR_CORE_API void logger_add_file_appender(gr_logger_ptr logger,std::string filename,bool append,std::string pattern);
00376 
00377 GR_CORE_API void logger_add_rollingfile_appender(gr_logger_ptr logger,std::string filename,
00378                     size_t filesize,int bkup_index,bool append,mode_t mode,std::string pattern);
00379 
00380 GR_CORE_API void logger_get_logger_names(std::vector<std::string>& names);
00381 
00382 /*!
00383  * \brief instantiate (configure) logger.
00384  * \ingroup logging
00385  *
00386  */
00387 class gr_logger
00388 {
00389  public:
00390   /*!
00391    * \brief contructor take log configuration file and configures loggers.
00392    */
00393   gr_logger(std::string config_filename)
00394   {
00395     // Load configuration file
00396     logger_load_config(config_filename);
00397   };
00398 
00399   /*!
00400    * \brief contructor take log configuration file and watchtime and configures
00401    */
00402   gr_logger(std::string config_filename, int watchPeriodSec)
00403   {
00404     // Load configuration file
00405     logger_load_config_and_watch(config_filename,watchPeriodSec);
00406 
00407   };
00408 
00409   static gr_logger_ptr getLogger(std::string name)
00410   {
00411       if(log4cpp::Category::exists(name)){
00412         gr_logger_ptr logger = &log4cpp::Category::getInstance(name);
00413         return logger;
00414       }
00415       else
00416       {
00417         gr_logger_ptr logger = &log4cpp::Category::getInstance(name);
00418         logger->setPriority(log4cpp::Priority::NOTSET);
00419         return logger;
00420       };
00421   };
00422 
00423   // Wrappers for logging macros
00424   /*! \brief inline function, wrapper to set the logger level */
00425   void set_level(std::string name,std::string level){GR_SET_LEVEL(name,level);}
00426   
00427   /*! \brief inline function, wrapper to get the logger level */
00428   void get_level(std::string name,std::string &level){GR_GET_LEVEL(name,level);}
00429 
00430   /*! \brief inline function, wrapper for DEBUG message */
00431   void debug(std::string name,std::string msg){GR_DEBUG(name,msg);};
00432 
00433   /*! \brief inline function, wrapper for INFO message */
00434   void info(std::string name,std::string msg){GR_INFO(name,msg);};
00435 
00436   /*! \brief inline function, wrapper for NOTICE message */
00437   void notice(std::string name,std::string msg){GR_NOTICE(name,msg);};
00438 
00439   /*! \brief inline function, wrapper for WARN message */
00440   void warn(std::string name,std::string msg){GR_WARN(name,msg);};
00441 
00442   /*! \brief inline function, wrapper for ERROR message */
00443   void error(std::string name,std::string msg){GR_ERROR(name,msg);};
00444 
00445   /*! \brief inline function, wrapper for CRIT message */
00446   void crit(std::string name,std::string msg){GR_CRIT(name,msg);};
00447 
00448   /*! \brief inline function, wrapper for ALERT message */
00449   void alert(std::string name,std::string msg){GR_ALERT(name,msg);};
00450 
00451   /*! \brief inline function, wrapper for FATAL message */
00452   void fatal(std::string name,std::string msg){GR_FATAL(name,msg);};
00453 
00454   /*! \brief inline function, wrapper for EMERG message */
00455   void emerg(std::string name,std::string msg){GR_EMERG(name,msg);};
00456 
00457   /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */
00458   void errorIF(std::string name,bool cond,std::string msg){GR_ERRORIF(name,cond,msg);};
00459 
00460   /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */
00461   void gr_assert(std::string name,bool cond,std::string msg){GR_ASSERT(name,cond,msg);};
00462 
00463   // Wrappers for Logger Pointer referenced functions
00464   /*! \brief inline function, wrapper to set the logger level */
00465   void set_log_level(gr_logger_ptr logger,std::string level){GR_LOG_SET_LEVEL(logger,level);}
00466 
00467   /*! \brief inline function, wrapper to get the logger level */
00468   void get_log_level(gr_logger_ptr logger,std::string &level){GR_LOG_GET_LEVEL(logger,level);}
00469 
00470   /*! \brief inline function, wrapper for LOG4CPP_DEBUG for DEBUG message */
00471   void log_debug(gr_logger_ptr logger,std::string msg){GR_LOG_DEBUG(logger,msg);};
00472 
00473   /*! \brief inline function, wrapper for LOG4CPP_INFO for INFO message */
00474   void log_info(gr_logger_ptr logger,std::string msg){GR_LOG_INFO(logger,msg);};
00475 
00476   /*! \brief inline function, wrapper for NOTICE message */
00477   void log_notice(gr_logger_ptr logger,std::string msg){GR_LOG_NOTICE(logger,msg);};
00478 
00479   /*! \brief inline function, wrapper for LOG4CPP_WARN for WARN message */
00480   void log_warn(gr_logger_ptr logger,std::string msg){GR_LOG_WARN(logger,msg);};
00481 
00482   /*! \brief inline function, wrapper for LOG4CPP_ERROR for ERROR message */
00483   void log_error(gr_logger_ptr logger,std::string msg){GR_LOG_ERROR(logger,msg);};
00484 
00485   /*! \brief inline function, wrapper for NOTICE message */
00486   void log_crit(gr_logger_ptr logger,std::string msg){GR_LOG_CRIT(logger,msg);};
00487 
00488   /*! \brief inline function, wrapper for ALERT message */
00489   void log_alert(gr_logger_ptr logger,std::string msg){GR_LOG_ALERT(logger,msg);};
00490 
00491   /*! \brief inline function, wrapper for FATAL message */
00492   void log_fatal(gr_logger_ptr logger,std::string msg){GR_LOG_FATAL(logger,msg);};
00493 
00494   /*! \brief inline function, wrapper for EMERG message */
00495   void log_emerg(gr_logger_ptr logger,std::string msg){GR_LOG_EMERG(logger,msg);};
00496 
00497   /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */
00498   void log_errorIF(gr_logger_ptr logger,bool cond,std::string msg){GR_LOG_ERRORIF(logger,cond,msg);};
00499 
00500   /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */
00501   void log_assert(gr_logger_ptr logger,bool cond,std::string msg){GR_LOG_ASSERT(logger,cond,msg);};
00502 };
00503 
00504 
00505 #endif /* HAVE_LOG4CPP */
00506 
00507 // If Logger disable do nothing
00508 #else /* ENABLE_GR_LOG */
00509 
00510 typedef void* gr_logger_ptr;
00511 
00512 #define GR_LOG_DECLARE_LOGPTR(logger)
00513 #define GR_LOG_ASSIGN_LOGPTR(logger,name)
00514 #define GR_CONFIG_LOGGER(config)
00515 #define GR_CONFIG_AND_WATCH_LOGGER(config,period)
00516 #define GR_LOG_GETLOGGER(logger, name) 
00517 #define GR_SET_LEVEL(name, level)
00518 #define GR_LOG_SET_LEVEL(logger, level) 
00519 #define GR_GET_LEVEL(name, level)
00520 #define GR_LOG_GET_LEVEL(logger, level)
00521 #define GR_ADD_CONSOLE_APPENDER(logger,target,pattern)
00522 #define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern)
00523 #define GR_ADD_FILE_APPENDER(name,filename,append,pattern)
00524 #define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern)
00525 #define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern)
00526 #define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern)
00527 #define GR_GET_LOGGER_NAMES(names)
00528 #define GR_RESET_CONFIGURATION()
00529 #define GR_DEBUG(name, msg)
00530 #define GR_INFO(name, msg)
00531 #define GR_NOTICE(name, msg)
00532 #define GR_WARN(name, msg)
00533 #define GR_ERROR(name, msg)
00534 #define GR_ALERT(name, msg)
00535 #define GR_CRIT(name, msg)
00536 #define GR_FATAL(name, msg)
00537 #define GR_EMERG(name, msg)
00538 #define GR_ERRORIF(name, cond, msg)
00539 #define GR_ASSERT(name, cond, msg)
00540 #define GR_LOG_DEBUG(logger, msg)
00541 #define GR_LOG_INFO(logger, msg)
00542 #define GR_LOG_NOTICE(logger, msg)
00543 #define GR_LOG_WARN(logger, msg)
00544 #define GR_LOG_ERROR(logger, msg)
00545 #define GR_LOG_ALERT(logger, msg)
00546 #define GR_LOG_CRIT(logger, msg)
00547 #define GR_LOG_FATAL(logger, msg)
00548 #define GR_LOG_EMERG(logger, msg)
00549 #define GR_LOG_ERRORIF(logger, cond, msg)
00550 #define GR_LOG_ASSERT(logger, cond, msg)
00551 
00552 #endif /* ENABLE_GR_LOG */
00553 #endif /* INCLUDED_GR_LOGGER_H */