libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Variables
qi::log::env::QI_DEFAULT_LOGHANDLER Namespace Reference

Namespaces

 value
 

Variables

char const *const name
 

Variable Documentation

char const* const qi::log::env::QI_DEFAULT_LOGHANDLER::name

Environment variable QI_DEFAULT_LOGHANDLER specifies which kind of log handler to set-up at logging system initialization time. Used by qi::log::init(). The table below sums up which log handler is automatically added according to the QI_DEFAULT_LOGHANDLER environment, the target OS platform and libqi WITH_SYSTEMD build option:

QI_DEFAULT_LOGHANDLER on Linux on Windows on Android on other platforms
"none" - - - -
"stdout" stdout stdout stdout stdout
"logger" logger* - logger -
"debugger" - debugger - -
"" or not defined logger* stdout logger stdout
any other value - - - -
Note
* Only if WITH_SYSTEMD is defined.
Notice that when WITH_SYSTEMD is defined, it is assumed that systemd-journal is actually available on the (linux) platform.

Into the details:

  • if QI_DEFAULT_LOGHANDLER=="none", no log handler is automatically registered at logging system initialization.
    Note
    Notice that log handlers may still be added with the qi::log::addHandler() function, but they won't receive the messages submitted before their addition. Even log handlers added at the very beginning of the main function, may still miss log messages. On the contrary, the default log handler should not miss any message as it is set up earlier, before the main is started (actually at static initialization time).
  • if QI_DEFAULT_LOGHANDLER=="stdout", the logs are written to stdout (using consoleloghandler).
    Note
    Notice that on Android platform stdout is usually redirected to /dev/null.
  • if QI_DEFAULT_LOGHANDLER=="logger", the logs are written to the system-wide logger. Currently supported are linux's journald (with WITH_SYSTEMD defined) and Android's log output.
  • if QI_DEFAULT_LOGHANDLER=="debugger", the logs are written to a debugging facility. Currently only Windows' debug output is implemented.
  • if QI_DEFAULT_LOGHANDLER=="" or is not defined, the behavior depends on the target OS platform:
  • if QI_DEFAULT_LOGHANDLER has an unsupported value, or if adding the handler fails, no fallback is performed: no log handler is registered by libqi, like if QI_DEFAULT_LOGHANDLER=="none", but an error message is sent to stderr.