BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Classes | Namespaces | Macros
logger.hpp File Reference
#include <fc/config.hpp>
#include <fc/time.hpp>
#include <fc/log/appender.hpp>
#include <fc/log/log_message.hpp>
#include <cstddef>
#include <memory>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/punctuation/paren.hpp>

Go to the source code of this file.

Classes

class  fc::logger
 

Namespaces

 fc
 

Macros

#define DEFAULT_LOGGER
 
#define FC_MULTILINE_MACRO_BEGIN   do {
 
#define FC_MULTILINE_MACRO_END   } while (0)
 
#define fc_dlog(LOGGER, FORMAT, ...)
 
#define fc_ilog(LOGGER, FORMAT, ...)
 
#define fc_wlog(LOGGER, FORMAT, ...)
 
#define fc_elog(LOGGER, FORMAT, ...)
 
#define dlog(FORMAT, ...)
 
#define ulog(FORMAT, ...)
 
#define ilog(FORMAT, ...)
 
#define wlog(FORMAT, ...)
 
#define elog(FORMAT, ...)
 
#define FC_FORMAT_ARG(r, unused, base)   BOOST_PP_STRINGIZE(base) ": ${" BOOST_PP_STRINGIZE( base ) "} "
 
#define FC_FORMAT_ARGS(r, unused, base)   BOOST_PP_LPAREN() BOOST_PP_STRINGIZE(base),fc::variant(base,FC_MAX_LOG_OBJECT_DEPTH) BOOST_PP_RPAREN()
 
#define FC_FORMAT(SEQ)   BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARG, v, SEQ )
 
#define FC_FORMAT_ARG_PARAMS(...)   BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARGS, v, __VA_ARGS__ )
 
#define FC_DUMP_FORMAT_ARG_NAME(r, unused, base)   "(" BOOST_PP_STRINGIZE(base) ")"
 
#define FC_DUMP_FORMAT_ARG_NAMES(SEQ)   BOOST_PP_SEQ_FOR_EACH( FC_DUMP_FORMAT_ARG_NAME, v, SEQ )
 
#define idump(SEQ)
 
#define wdump(SEQ)
 
#define edump(SEQ)
 

Macro Definition Documentation

◆ DEFAULT_LOGGER

#define DEFAULT_LOGGER

Definition at line 60 of file logger.hpp.

◆ dlog

#define dlog (   FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
(fc::logger::get(DEFAULT_LOGGER)).log( FC_LOG_MESSAGE( debug, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 100 of file logger.hpp.

◆ edump

#define edump (   SEQ)
Value:
do { \
try { \
elog( FC_FORMAT(SEQ), FC_FORMAT_ARG_PARAMS(SEQ) ); \
} catch( ... ) { \
elog ( "[ERROR: Got exception while trying to dump ( ${args} )]",("args",FC_DUMP_FORMAT_ARG_NAMES(SEQ)) ); \
} \
} while( false )

Definition at line 182 of file logger.hpp.

◆ elog

#define elog (   FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
(fc::logger::get(DEFAULT_LOGGER)).log( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 129 of file logger.hpp.

◆ fc_dlog

#define fc_dlog (   LOGGER,
  FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
if( (LOGGER).is_enabled( fc::log_level::debug ) ) \
(LOGGER).log( FC_LOG_MESSAGE( debug, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 76 of file logger.hpp.

◆ FC_DUMP_FORMAT_ARG_NAME

#define FC_DUMP_FORMAT_ARG_NAME (   r,
  unused,
  base 
)    "(" BOOST_PP_STRINGIZE(base) ")"

Definition at line 157 of file logger.hpp.

◆ FC_DUMP_FORMAT_ARG_NAMES

#define FC_DUMP_FORMAT_ARG_NAMES (   SEQ)    BOOST_PP_SEQ_FOR_EACH( FC_DUMP_FORMAT_ARG_NAME, v, SEQ )

Definition at line 160 of file logger.hpp.

◆ fc_elog

#define fc_elog (   LOGGER,
  FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
if( (LOGGER).is_enabled( fc::log_level::error ) ) \
(LOGGER).log( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 94 of file logger.hpp.

◆ FC_FORMAT

#define FC_FORMAT (   SEQ)    BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARG, v, SEQ )

Definition at line 149 of file logger.hpp.

◆ FC_FORMAT_ARG

#define FC_FORMAT_ARG (   r,
  unused,
  base 
)    BOOST_PP_STRINGIZE(base) ": ${" BOOST_PP_STRINGIZE( base ) "} "

Definition at line 143 of file logger.hpp.

◆ FC_FORMAT_ARG_PARAMS

#define FC_FORMAT_ARG_PARAMS (   ...)    BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARGS, v, __VA_ARGS__ )

Definition at line 154 of file logger.hpp.

◆ FC_FORMAT_ARGS

#define FC_FORMAT_ARGS (   r,
  unused,
  base 
)    BOOST_PP_LPAREN() BOOST_PP_STRINGIZE(base),fc::variant(base,FC_MAX_LOG_OBJECT_DEPTH) BOOST_PP_RPAREN()

Definition at line 146 of file logger.hpp.

◆ fc_ilog

#define fc_ilog (   LOGGER,
  FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
if( (LOGGER).is_enabled( fc::log_level::info ) ) \
(LOGGER).log( FC_LOG_MESSAGE( info, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 82 of file logger.hpp.

◆ FC_MULTILINE_MACRO_BEGIN

#define FC_MULTILINE_MACRO_BEGIN   do {

Definition at line 65 of file logger.hpp.

◆ FC_MULTILINE_MACRO_END

#define FC_MULTILINE_MACRO_END   } while (0)

Definition at line 73 of file logger.hpp.

◆ fc_wlog

#define fc_wlog (   LOGGER,
  FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
if( (LOGGER).is_enabled( fc::log_level::warn ) ) \
(LOGGER).log( FC_LOG_MESSAGE( warn, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 88 of file logger.hpp.

◆ idump

#define idump (   SEQ)
Value:
do { \
try { \
ilog( FC_FORMAT(SEQ), FC_FORMAT_ARG_PARAMS(SEQ) ); \
} catch( ... ) { \
ilog ( "[ERROR: Got exception while trying to dump ( ${args} )]",("args",FC_DUMP_FORMAT_ARG_NAMES(SEQ)) ); \
} \
} while( false )

Definition at line 166 of file logger.hpp.

◆ ilog

#define ilog (   FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
(fc::logger::get(DEFAULT_LOGGER)).log( FC_LOG_MESSAGE( info, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 117 of file logger.hpp.

◆ ulog

#define ulog (   FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
if( (fc::logger::get("user")).is_enabled( fc::log_level::debug ) ) \
(fc::logger::get("user")).log( FC_LOG_MESSAGE( debug, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Sends the log message to a special 'user' log stream designed for messages that the end user may like to see.

Definition at line 110 of file logger.hpp.

◆ wdump

#define wdump (   SEQ)
Value:
do { \
try { \
wlog( FC_FORMAT(SEQ), FC_FORMAT_ARG_PARAMS(SEQ) ); \
} catch( ... ) { \
wlog ( "[ERROR: Got exception while trying to dump ( ${args} )]",("args",FC_DUMP_FORMAT_ARG_NAMES(SEQ)) ); \
} \
} while( false )

Definition at line 174 of file logger.hpp.

◆ wlog

#define wlog (   FORMAT,
  ... 
)
Value:
FC_MULTILINE_MACRO_BEGIN \
(fc::logger::get(DEFAULT_LOGGER)).log( FC_LOG_MESSAGE( warn, FORMAT, __VA_ARGS__ ) ); \
FC_MULTILINE_MACRO_END

Definition at line 123 of file logger.hpp.

fc::log_level::error
@ error
Definition: log_message.hpp:38
fc::log_level::warn
@ warn
Definition: log_message.hpp:37
FC_DUMP_FORMAT_ARG_NAMES
#define FC_DUMP_FORMAT_ARG_NAMES(SEQ)
Definition: logger.hpp:160
fc::log_level::debug
@ debug
Definition: log_message.hpp:35
FC_FORMAT_ARG_PARAMS
#define FC_FORMAT_ARG_PARAMS(...)
Definition: logger.hpp:154
DEFAULT_LOGGER
#define DEFAULT_LOGGER
Definition: logger.hpp:60
fc::logger::get
static logger get(const std::string &name="default")
Definition: logger.cpp:87
fc::log_level::info
@ info
Definition: log_message.hpp:36
FC_FORMAT
#define FC_FORMAT(SEQ)
Definition: logger.hpp:149
FC_LOG_MESSAGE
#define FC_LOG_MESSAGE(LOG_LEVEL, FORMAT,...)
A helper method for generating log messages.
Definition: log_message.hpp:163