spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Interface for notifying that spdlog drops a log?

Open mudream4869 opened this issue 1 year ago • 1 comments

Blocking mode is dangerous for services, but when selecting overrun mode, there is a risk of losing logs.

Not sure if there is an interface (ex: pass a callback function?) when spdlog is dropping a log.

Example callback interface?:

void func(const Log& log) noexcept {
}

mudream4869 avatar Aug 18 '22 09:08 mudream4869

There is no API to notify asynchronous log drops. However, spdlog::details::thread_pool::overrun_counter() lets you know how many logs were dropped due to overruns.

https://github.com/gabime/spdlog/blob/f44fa31f5110331af196d0ed7f00ae1c7b8ef3cc/include/spdlog/details/thread_pool.h#L99-L100

tt4g avatar Aug 18 '22 10:08 tt4g