Skip to content

Wolf logging macro

Jeremie Deray requested to merge wolf_logging into master

Notice: This PR is only about simple wolf logging macro as described below and do not implement any data logging as this topic as to be discussed. A data logging draft class is implemented on branch wolf_data_logging.

Enable logging macro using third-party spdlog (MIT license) :

  • WOLF_INFO
  • WOLF_WARN
  • WOLF_ERROR
  • WOLF_DEBUG (enabled only if compiled in debug)
  • WOLF_TRACE (which is the same as WOLF_DEBUG_HERE but enabled/disabled at compile time)

Trace logging is enabled/disabled from the src/CMakeLists.txt option

option(_WOLF_TRACE "Enable wolf tracing macro" OFF)

test_wolf_logging.cpp shows the following:

  WOLF_INFO("test info ", 5, " ", 0.123);
  WOLF_WARN("test warn ", 5, " ", 0.123);
  WOLF_ERROR("test error ", 5, " ", 0.123);
  WOLF_TRACE("test trace ", 5, " ", 0.123);
  WOLF_DEBUG("test debug ", 5, " ", 0.123);

Which, full feature enabled, produces :

Screenshot_from_2016-11-04_17_47_20

The log pattern is :
[thread id][hour:min:sec.nanosec][log type] log-content

The TRACE log pattern is :
[thread id][hour:min:sec.nanosec][log type][$file l#$line : $function] log-content

Merge request reports