clutchlog  0.11.1
Macros
High-level API macros

Macros

#define CLUTCHLOC   __FILE__, __FUNCTION__, __LINE__
 Handy shortcuts to location.
 
#define CLUTCHLOG(LEVEL, WHAT)
 Log a message at the given level. More...
 
#define CLUTCHDUMP(LEVEL, CONTAINER, FILENAME)
 Dump the given container. More...
 
#define CLUTCHFUNC(LEVEL, FUNC, ...)
 Call any function if the scope matches. More...
 
#define CLUTCHCODE(LEVEL, ...)
 Run any code if the scope matches. More...
 

Detailed Description

Macro Definition Documentation

◆ CLUTCHCODE

#define CLUTCHCODE (   LEVEL,
  ... 
)
Value:
do { \
auto& clutchlog__logger = clutchlog::logger(); \
clutchlog::scope_t clutchlog__scope = clutchlog__logger.locate(clutchlog::level::LEVEL, CLUTCHLOC); \
if(clutchlog__scope.matches) { \
__VA_ARGS__ \
} \
} while(0)

Run any code if the scope matches.

◆ CLUTCHDUMP

#define CLUTCHDUMP (   LEVEL,
  CONTAINER,
  FILENAME 
)
Value:
do { \
auto& clutchlog__logger = clutchlog::logger(); \
clutchlog__logger.dump(clutchlog::level::LEVEL, std::begin(CONTAINER), std::end(CONTAINER), \
} while(0)

Dump the given container.

◆ CLUTCHFUNC

#define CLUTCHFUNC (   LEVEL,
  FUNC,
  ... 
)
Value:
do { \
auto& clutchlog__logger = clutchlog::logger(); \
clutchlog::scope_t clutchlog__scope = clutchlog__logger.locate(clutchlog::level::LEVEL, CLUTCHLOC); \
if(clutchlog__scope.matches) { \
FUNC(__VA_ARGS__); \
} \
} while(0)

Call any function if the scope matches.

◆ CLUTCHLOG

#define CLUTCHLOG (   LEVEL,
  WHAT 
)
Value:
do { \
auto& clutchlog__logger = clutchlog::logger(); \
std::ostringstream clutchlog__msg ; clutchlog__msg << WHAT; \
clutchlog__logger.log(clutchlog::level::LEVEL, clutchlog__msg.str(), CLUTCHLOC); \
} while(0)

Log a message at the given level.

CLUTCHDUMP_DEFAULT_SEP
#define CLUTCHDUMP_DEFAULT_SEP
Compile-time default item separator for dump.
Definition: clutchlog.h:239
CLUTCHLOC
#define CLUTCHLOC
Handy shortcuts to location.
Definition: clutchlog.h:77
clutchlog::logger
static clutchlog & logger()
Get the logger instance.
Definition: clutchlog.h:291