clutchlog 0.17
High-level API macros

Detailed Description

Macros

#define CLUTCHLOC   __FILE__, __FUNCTION__, __LINE__
 Handy shortcuts to location. More...
 
#define CLUTCHLOGD(LEVEL, WHAT, DEPTH_DELTA)
 Log a message at the given level and with a given depth delta. More...
 
#define CLUTCHLOG(LEVEL, WHAT)    CLUTCHLOGD(LEVEL, WHAT, 0)
 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...
 

Macro Definition Documentation

◆ CLUTCHLOC

#define CLUTCHLOC   __FILE__, __FUNCTION__, __LINE__

Handy shortcuts to location.

Definition at line 78 of file clutchlog.h.

◆ CLUTCHLOGD

#define CLUTCHLOGD (   LEVEL,
  WHAT,
  DEPTH_DELTA 
)
Value:
do { \
auto& clutchlog__logger = clutchlog::logger(); \
std::ostringstream clutchlog__msg ; clutchlog__msg << WHAT; \
clutchlog__logger.log(clutchlog::level::LEVEL, clutchlog__msg.str(), CLUTCHLOC, DEPTH_DELTA); \
} while(0)
static clutchlog & logger()
Get the logger instance.
Definition: clutchlog.h:307
#define CLUTCHLOC
Handy shortcuts to location.
Definition: clutchlog.h:78

Log a message at the given level and with a given depth delta.

Definition at line 82 of file clutchlog.h.

◆ CLUTCHLOG

#define CLUTCHLOG (   LEVEL,
  WHAT 
)     CLUTCHLOGD(LEVEL, WHAT, 0)

Log a message at the given level.

Definition at line 99 of file clutchlog.h.

◆ 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)
#define CLUTCHDUMP_DEFAULT_SEP
Compile-time default item separator for dump.
Definition: clutchlog.h:250

Dump the given container.

Definition at line 108 of file clutchlog.h.

◆ 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.

Definition at line 125 of file clutchlog.h.

◆ 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.

Definition at line 146 of file clutchlog.h.