Skip to content
Snippets Groups Projects
Commit d4222064 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Merge branch 'wolf_logging' into 'master'

Wolf logging macro

**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](https://gitlab.iri.upc.edu/mobile_robotics/wolf/blob/wolf_data_logging/src/data_logging.h).

Enable logging macro using third-party [spdlog](https://github.com/gabime/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  
```cmake
option(_WOLF_TRACE "Enable wolf tracing macro" OFF)
```

`test_wolf_logging.cpp` shows the following: 

```cpp
  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](/uploads/d28619287c4946c787673afb1d1b516e/Screenshot_from_2016-11-04_17_47_20.png)

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`

See merge request !99
parents 775be5b3 b26a4888
No related branches found
No related tags found
1 merge request!99Wolf logging macro
Showing
with 3650 additions and 1 deletion
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment