refactor(core): SpyLog rework
Description
SpyLog has been unnecessarily complex for a long time. In this rework, we propose to:
- deprecate the loglevel
TRACE
. OnlySLM_TRACE_FUNC()
remains, but its occurrences should never be committed. - deprecate
OSLM_*
macros in favor ofSLM_*
macros, which now take stringstreams as input (no performance penalty) - all loglevels are now always compiled, which means that the big bloat of
SPYLOG_*
CMake variables were removed. - occurrences of
OSLM_*
macros were replaced bySLM_*
macros - occurrences of
O?SLM_TRACE*
macros were removed or replaced by higher levels logging macros - the default displayed log level is now
WARN
- the path of files displayed in the output was shortened to keep the minimum information needed: namespace(s), source file.
People are now encouraged to be smarter in the way they use the logging levels:
- ERROR: when something unexpected occurs, but keep in mind this is for developpers. To handle a real error and inform the user, please use GUI features.
- WARN: when something that is potentially harmful happens.
- INFO: allows keeping track of important events in the code. Only meaningful information for all developers should be kept.
- DEBUG: allows debugging the code, to display internal states, variables, etc... It is not recommended to let such macros in production code.
In any case, logging macros in tight loops should never be committed into production code. They are the only cause of performance penalty.
Remember the default displayed can be changed anytime with --log-*
arguments on fwlauncher command line. This works with application shortcuts. Ex:
bin/tuto03dataservice --log-debug
People are also encouraged to filter out the output of the logs, either directly on the command line, i.e. :
bin/tuto01basic --log-debug 2> >(grep fwServices >&2)
or using a third application, like glogg (available on all platforms, apt install glogg
on Mint. Remember to output the log in a file:
bin/tuto03dataservice --log-info --flog
and then launch glogg on SLM.log (or other path if you change it using --log-output
:
Closes #611 (closed) #88 (closed)
How to test it?
Test some apps with differents log levels on the command line.