Define LOG_MDC_INIT

Define Documentation

LOG_MDC_INIT(func)

Register function for initialization of MDC. This function will be called for current thread and every new thread (but not for other existing threads) before any message is logged using one of the macros below. Its main purpose is to initialize MDC (using LOG_MDC macro). In some cases the function may be called more than once per thread.

This macro is thread safe, but typically it will be called from main thread before any other LOG macro.

Macro returns an integer number, the value is not specified, but this allows it to be used in one-time initialization constructs like:

static int dummyMdcInit = LOG_MDC_INIT(some_init_func);

Parameters
  • func: Any function object which takes no arguments and returns void.