Skip to content

Enhance logging

Jeremie Deray requested to merge enhance_logging into master

Seriously upgrade the WOLF logging !

Those familiar with ROS logging macros will clearly see the parallel.

  • Review the synergy Logger <-> Singleton
  • Changed logging message header : Before : [info][16:47:59.548894601][4450] logging text Now : [info][10/09/17 - 16:47:59.548894601] logging text So basically we get the full date which is useful when some logging are thrown to a txt file for later review. Moreover I removed the thread ID since wolf does not support multi-thread for now. I could be re-enabled later on.
  • Add LoggerManager -> basically a map<string, Logger>
  • Add a couple new logging macros :
    • first set adds the _COND key-word to the existing macros. It is thus a conditional logging e.g.
      WOLF_INFO_COND(true, "will be printed"); WOLF_WARN_COND(false, "will NOT be printed");
    • second set adds the _NAMED key-word which allows custom loggers. Those loggers will print their own name as part of the message header e.g. WOLF_INFO_NAMED("my proc", "this is fine.") -> [info][10/09/17 - 16:47:59.548894601][my proc] this is fine. .
      _NAMED macro come of course with the combination _NAMED_COND.
    • third set are located in the file processor_logging.h which defines a bunch of pre-named macros using the processor getType.
      e.g. WOLF_PROCESSOR_DEBUG("this works fine"); -> [debug][10/09/17 - 16:47:59.548894601][ODOM 2D] this works fine. WOLF_PROCESSOR_DEBUG_COND(my_test_bool, "this test passed"); -> [debug][10/09/17 - 16:47:59.548894601][ODOM 2D] this test passed.
      Those WOLF_PROCESSOR_ macros also implement a static_assert making sure they are called only from within a Processor.

This all came for the need of a 'finer' granularity in the logging, especially in when compiled in debug and all kind of crazy messages appears.

Edited by Jeremie Deray

Merge request reports

Loading