RafaGago / mini-async-log

Non bloated asynchronous logger
Other
221 stars 20 forks source link

Can I add new log levels? #9

Closed ruipacheco closed 7 years ago

ruipacheco commented 7 years ago

spdlog has trace support which is great for development - it's only included if DEBUG is enabled or a specific flag is passed at compile time. Do you support the same?

RafaGago commented 7 years ago

There already 6 log levels in place (0 to 5).. Check the sev structure on this file:

https://github.com/RafaGago/mini-async-log/blob/master/include/mal_log/frontend_types.hpp

The log severities are (and will be) static, as they are serialized to a memory blob with no more avaliable bits.

BTW, you use the macros with the embedded log level directly, e.g.

log_debug("my data is {}", data);

You can add debug printouts freely in your code, as you can remove these entries at compile time by e.g. defining the preprocessor variable "MAL_STRIP_LOG_DEBUG". This will remove them (and some of the template code bloat).

"MAL_STRIP_LOG_SEVERITY 0" will remove the logging log level at compile time, "MAL_STRIP_LOG_SEVERITY 1" the debug and trace, etc...