Create an asynchronous logger but only for some trace levels #2186
-
Hello, My project has an old (and not really working) logger system and I am looking for a COTS that fulfills my requirements. Right now, I have several levels of tracing (DEBUG, INFO, WARNING, CRITICAL). Thanks for the help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is no implementation that delays the output of a particular log level, but the OS buffers the output to console or file, and the output is delayed until the spdlog flush operation is invoked. You can set the log level to force the output of buffered log messages with See Wiki: https://github.com/gabime/spdlog/wiki/7.-Flush-policy If you want to do queuing in your application instead of relying on OS buffering, you can create a custom sink (https://github.com/gabime/spdlog/wiki/4.-Sinks#implementing-your-own-sink). |
Beta Was this translation helpful? Give feedback.
There is no implementation that delays the output of a particular log level, but the OS buffers the output to console or file, and the output is delayed until the spdlog flush operation is invoked.
You can set the log level to force the output of buffered log messages with
spdlog::flush_on()
(orspdlog::logger::flush_on()
).See Wiki: https://github.com/gabime/spdlog/wiki/7.-Flush-policy
If you want to do queuing in your application instead of relying on OS buffering, you can create a custom sink (https://github.com/gabime/spdlog/wiki/4.-Sinks#implementing-your-own-sink).