PlatformLab / NanoLog

Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.
Other
3k stars 343 forks source link

Having a background text file writer instead of the compressor with binary log writer #58

Open gh-andre opened 2 years ago

gh-andre commented 2 years ago

NanoLog is a very impressive logger that does what many other loggers don't quite achieve, like writing logged data directly into string buffers instead of using various intermediate variables, or capturing time stamps at the time of logging instead of at the time of writing into a log sink to ensure their order (even though the decompressor has to order them via a heap).

However, as impressive as many of these features are, many applications need a text log immediately available, without having to run a decompressor, and I think it would help many applications out there if NanoLog could, instead of running a compressor thread, run a text writer thread, which would dequeue string buffers with log data, order them by time (maybe within some limited time frame window), format log entries as text and write to a text log file.

Along the same lines, NanoLog could also provide a method for applications to call on their own thread, which would do all of the above and return a formatted log line or a log buffer that applications could use any way they see fit, such as dumping them to a file, network, etc.