You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very new to quill. I am not sure if this is an issue for quill.
If an application prints just 1 log message ("program starts"), will quill use '\n' or std::endl here?
Will the log be buffered for a long time if the application doesn't log any more messages?
Sometimes it is not obvious to see whether a program doesn't hit that line of code or the log message is buffered, which causes some debugging anxiety.
Probably it will be better if quill backend thread can have an option to flush every X seconds, this can minimize lost messages during an unexpected crash. quill backend will do some unnecessary work here, but the main app thread can avoid paying the cost of calling quill::flush(). So main app thread can be fast, without worrying too much about logging messages being buffered.
The text was updated successfully, but these errors were encountered:
For each logged message Quill is using \n. It won't use something like std::endl as that would force flush each message.
Currently Quill is letting the OS to buffer all messages and the backend worker thread will never force flush.
The logic for this is here and I also have a TODOhere
So what basically happens is :
Quill buffers a log message to the OS but never force flushes
If there are no more messages to process the backend thread goes into sleep but it will never force flush. I didn't want to spam flush on all handlers unconditionally when there are no more messages to log as there might be no messages for a long time.
The backend thread however will always force flush everything before the application terminates. This is only in the case the application terminates successfully, not if it crashes
I understand your issue while debugging a running application you want to watch the logs.
I will add a flush_every option when there are no more messages to buffer here that will flush all active handlers
or
If there are no more messages left to log and we already buffered some unflushed messages then flush before sleep()
I will probably go for option 2 as it doesn't have to force flush() when there are zero buffered messages
Thank you for quick turn-around. This implementation is better than flush every X seconds. I was thinking flush every X seconds would be a quick implementation. But your code is well written to prepare for this kind of change. Great work!
I am very new to quill. I am not sure if this is an issue for quill.
If an application prints just 1 log message ("program starts"), will quill use '\n' or std::endl here?
Will the log be buffered for a long time if the application doesn't log any more messages?
Sometimes it is not obvious to see whether a program doesn't hit that line of code or the log message is buffered, which causes some debugging anxiety.
Probably it will be better if quill backend thread can have an option to flush every X seconds, this can minimize lost messages during an unexpected crash. quill backend will do some unnecessary work here, but the main app thread can avoid paying the cost of calling quill::flush(). So main app thread can be fast, without worrying too much about logging messages being buffered.
The text was updated successfully, but these errors were encountered: