An Overlay-based
Virtual Network Substrate
SpoVNet

Changeset 9737 for source


Ignore:
Timestamp:
Apr 7, 2011, 4:36:00 PM (8 years ago)
Author:
Christoph Mayer
Message:

-logging optional

Location:
source/ariba/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/logging/Logging.h

    r7748 r9737  
    4545
    4646#ifdef HAVE_LOG4CXX_LOGGER_H
    47 #include <log4cxx/logger.h>
    48 #include <log4cxx/basicconfigurator.h>
     47        #include <log4cxx/logger.h>
     48        #include <log4cxx/basicconfigurator.h>
    4949#endif // HAVE_LOG4CXX_LOGGER_H
    5050
    5151#ifdef LOGCOLORS
    52 
    5352  #define colorDefault { std::cout << "\033[0m";  } /*reset*/
    5453  #define colorDebug   { std::cout << "\033[0;33m"; } /*cyan*/
     
    5857
    5958#else
    60 
    6159  #define colorDefault { }
    6260  #define colorDebug   { }
     
    6462  #define colorWarn    { }
    6563  #define colorError   { }
    66 
    6764#endif // ENABLE_LOGCOLORS
    6865
     
    8380  #define logging_fatal(x)  {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); }
    8481
     82  #define logging_rootlevel_debug()       {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getDebug()); }
     83  #define logging_rootlevel_info()        {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getInfo() ); }
     84  #define logging_rootlevel_warn()        {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getWarn() ); }
     85  #define logging_rootlevel_error()       {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getError()); }
     86
     87  #define logging_classlevel_debug(x) {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getDebug()); }
     88  #define logging_classlevel_info(x)  {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getInfo());  }
     89  #define logging_classlevel_warn(x)  {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getWarn());  }
     90  #define logging_classlevel_error(x) {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getError()); }
     91
    8592#else // HAVE_LOG4CXX_LOGGER_H
    8693
    8794  #define use_logging_h(x)
    88 
    8995  #define use_logging_cpp(x)
    9096
    9197  #define logging_stdout(x) std::cout << x << std::endl;
    9298
    93   #define logging_trace(x)
    94   #define logging_debug(x)  {colorDebug; logging_stdout(x); colorDefault;           }
    95   #define logging_info(x)   {colorInfo;  logging_stdout(x);  colorDefault;           }
    96   #define logging_warn(x)   {colorWarn;  logging_stdout(x);  colorDefault;           }
    97   #define logging_error(x)  {colorError; logging_stdout(x); colorDefault;           }
    98   #define logging_fatal(x)  {colorError; logging_stdout(x); colorDefault; exit(-1); }
     99  static int __loglevel__ = 2; //default is info
     100
     101  #define logging_trace(x)  {            logging_stdout(x);                         }
     102  #define logging_debug(x)  {if(__loglevel__ <= 1){ colorDebug; logging_stdout(x); colorDefault; }}
     103  #define logging_info(x)   {if(__loglevel__ <= 2){ colorInfo;  logging_stdout(x); colorDefault; }}
     104  #define logging_warn(x)   {if(__loglevel__ <= 3){ colorWarn;  logging_stdout(x); colorDefault; }}
     105  #define logging_error(x)  {                     return; colorError; logging_stdout(x); colorDefault;           }
     106  #define logging_fatal(x)  {                     return; colorError; logging_stdout(x); colorDefault; exit(-1); }
     107
     108  #define logging_rootlevel_debug()       {__loglevel__ = 1;}
     109  #define logging_rootlevel_info()        {__loglevel__ = 2;}
     110  #define logging_rootlevel_warn()        {__loglevel__ = 3;}
     111  #define logging_rootlevel_error()       {__loglevel__ = 4;}
     112
     113  #define logging_classlevel_debug(x) {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
     114  #define logging_classlevel_info(x)  {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
     115  #define logging_classlevel_warn(x)  {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
     116  #define logging_classlevel_error(x) {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
    99117
    100118#endif // HAVE_LOG4CXX_LOGGER_H
  • source/ariba/utility/system/StartupWrapper.cpp

    r7916 r9737  
    4141
    4242#ifdef HAVE_LOG4CXX_LOGGER_H
    43 #include <log4cxx/logger.h>
    44 #include <log4cxx/basicconfigurator.h>
     43        #include <log4cxx/logger.h>
     44        #include <log4cxx/basicconfigurator.h>
    4545#endif // HAVE_LOG4CXX_LOGGER_H
    4646
     
    9696        // init the logging system
    9797        //
    98         // configure the logging
    99         //
    100        
     98
    10199#ifdef HAVE_LOG4CXX_LOGGER_H
    102100        log4cxx::BasicConfigurator::configure();
     101#endif //HAVE_LOG4CXX_LOGGER_H
    103102
    104         // set the global log level to warning
    105         {
    106                 log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
    107                 logger->setLevel(log4cxx::Level::getInfo());
    108         }
     103        //
     104        // configure the default logging level to info
     105        //
    109106
    110         // set up again an individual level if you like
    111 #ifndef HAVE_MAEMO
    112         {
    113                 //log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("MCPO"));
    114                 //logger->setLevel(log4cxx::Level::getDebug());
    115         }
    116 #endif //HAVE_MAEMO
    117 #endif //HAVE_LOG4CXX_LOGGER_H
     107        logging_rootlevel_info();
    118108}
    119109
Note: See TracChangeset for help on using the changeset viewer.