Changeset 9737 for source/ariba/utility
- Timestamp:
- Apr 7, 2011, 4:36:00 PM (14 years ago)
- Location:
- source/ariba/utility
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/logging/Logging.h
r7748 r9737 45 45 46 46 #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> 49 49 #endif // HAVE_LOG4CXX_LOGGER_H 50 50 51 51 #ifdef LOGCOLORS 52 53 52 #define colorDefault { std::cout << "\033[0m"; } /*reset*/ 54 53 #define colorDebug { std::cout << "\033[0;33m"; } /*cyan*/ … … 58 57 59 58 #else 60 61 59 #define colorDefault { } 62 60 #define colorDebug { } … … 64 62 #define colorWarn { } 65 63 #define colorError { } 66 67 64 #endif // ENABLE_LOGCOLORS 68 65 … … 83 80 #define logging_fatal(x) {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); } 84 81 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 85 92 #else // HAVE_LOG4CXX_LOGGER_H 86 93 87 94 #define use_logging_h(x) 88 89 95 #define use_logging_cpp(x) 90 96 91 97 #define logging_stdout(x) std::cout << x << std::endl; 92 98 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;} 99 117 100 118 #endif // HAVE_LOG4CXX_LOGGER_H -
source/ariba/utility/system/StartupWrapper.cpp
r7916 r9737 41 41 42 42 #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> 45 45 #endif // HAVE_LOG4CXX_LOGGER_H 46 46 … … 96 96 // init the logging system 97 97 // 98 // configure the logging 99 // 100 98 101 99 #ifdef HAVE_LOG4CXX_LOGGER_H 102 100 log4cxx::BasicConfigurator::configure(); 101 #endif //HAVE_LOG4CXX_LOGGER_H 103 102 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 // 109 106 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(); 118 108 } 119 109
Note:
See TracChangeset
for help on using the changeset viewer.