From 0c0a53541ac7954acb13acf346057a8d92348922 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 16 Jun 2014 16:27:21 -0400 Subject: [PATCH] made it easier to define custom loggers per file --- include/fc/log/logger.hpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/include/fc/log/logger.hpp b/include/fc/log/logger.hpp index a885cfd..a5b21f1 100644 --- a/include/fc/log/logger.hpp +++ b/include/fc/log/logger.hpp @@ -57,6 +57,10 @@ namespace fc } // namespace fc +#ifndef DEFAULT_LOOGER +#define DEFAULT_LOOGER +#endif + #define fc_dlog( LOGGER, FORMAT, ... ) \ do { \ @@ -88,29 +92,29 @@ namespace fc #define dlog( FORMAT, ... ) \ do { \ - if( (fc::logger::get()).is_enabled( fc::log_level::debug ) ) { \ - (fc::logger::get()).log( FC_LOG_MESSAGE( debug, FORMAT, __VA_ARGS__ ) ); \ + if( (fc::logger::get(DEFAULT_LOOGER)).is_enabled( fc::log_level::debug ) ) { \ + (fc::logger::get(DEFAULT_LOOGER)).log( FC_LOG_MESSAGE( debug, FORMAT, __VA_ARGS__ ) ); \ } \ } while (0) #define ilog( FORMAT, ... ) \ do { \ - if( (fc::logger::get()).is_enabled( fc::log_level::info ) ) { \ - (fc::logger::get()).log( FC_LOG_MESSAGE( info, FORMAT, __VA_ARGS__ ) ); \ + if( (fc::logger::get(DEFAULT_LOOGER)).is_enabled( fc::log_level::info ) ) { \ + (fc::logger::get(DEFAULT_LOOGER)).log( FC_LOG_MESSAGE( info, FORMAT, __VA_ARGS__ ) ); \ } \ } while (0) #define wlog( FORMAT, ... ) \ do { \ - if( (fc::logger::get()).is_enabled( fc::log_level::warn ) ) { \ - (fc::logger::get()).log( FC_LOG_MESSAGE( warn, FORMAT, __VA_ARGS__ ) ); \ + if( (fc::logger::get(DEFAULT_LOOGER)).is_enabled( fc::log_level::warn ) ) { \ + (fc::logger::get(DEFAULT_LOOGER)).log( FC_LOG_MESSAGE( warn, FORMAT, __VA_ARGS__ ) ); \ } \ } while (0) #define elog( FORMAT, ... ) \ do { \ - if( (fc::logger::get()).is_enabled( fc::log_level::error ) ) { \ - (fc::logger::get()).log( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \ + if( (fc::logger::get(DEFAULT_LOOGER)).is_enabled( fc::log_level::error ) ) { \ + (fc::logger::get(DEFAULT_LOOGER)).log( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \ } \ } while (0)