[log] Default logging configuration for trivial logger

Hi, I'm using the trivial logging interface, but I need to tweak the default configuration. I want to be able to flush after every log entry, and I also want to be able to do file rolling. As far as I can tell, in order to configure it this way, I pretty much need to configure the whole thing from scratch including formatters, but I can't find the code that sets up the default logger to replicate it. Any pointers? Cheers, Ben

On Tue, Feb 18, 2014 at 12:28 PM, Ben Pope
Hi,
I'm using the trivial logging interface, but I need to tweak the default configuration. I want to be able to flush after every log entry, and I also want to be able to do file rolling.
As far as I can tell, in order to configure it this way, I pretty much need to configure the whole thing from scratch including formatters, but I can't find the code that sets up the default logger to replicate it.
Any pointers?
Yes, you have to create and configure the sink yourself to do that. The default sink cannot be accessed. It is rather specialized and cannot be customized in any way, so it wouldn't be of use for you anyway.

On 18/02/14 16:49, Andrey Semashev wrote:
On Tue, Feb 18, 2014 at 12:28 PM, Ben Pope
wrote: Hi,
I'm using the trivial logging interface, but I need to tweak the default configuration. I want to be able to flush after every log entry, and I also want to be able to do file rolling.
As far as I can tell, in order to configure it this way, I pretty much need to configure the whole thing from scratch including formatters, but I can't find the code that sets up the default logger to replicate it.
Any pointers?
Yes, you have to create and configure the sink yourself to do that. The default sink cannot be accessed. It is rather specialized and cannot be customized in any way, so it wouldn't be of use for you anyway.
The code for the default formatter and sink must exist somewhere for inspiration, no? Ben

On Tue, Feb 18, 2014 at 1:25 PM, Ben Pope
On 18/02/14 16:49, Andrey Semashev wrote:
On Tue, Feb 18, 2014 at 12:28 PM, Ben Pope
wrote: Hi,
I'm using the trivial logging interface, but I need to tweak the default configuration. I want to be able to flush after every log entry, and I also want to be able to do file rolling.
As far as I can tell, in order to configure it this way, I pretty much need to configure the whole thing from scratch including formatters, but I can't find the code that sets up the default logger to replicate it.
Any pointers?
Yes, you have to create and configure the sink yourself to do that. The default sink cannot be accessed. It is rather specialized and cannot be customized in any way, so it wouldn't be of use for you anyway.
The code for the default formatter and sink must exist somewhere for inspiration, no?
It's in libs/log/src/default_sink.cpp.

On Tuesday, February 18, 2014 07:28 PM, Andrey Semashev wrote:
On Tue, Feb 18, 2014 at 1:25 PM, Ben Pope
wrote: On 18/02/14 16:49, Andrey Semashev wrote:
On Tue, Feb 18, 2014 at 12:28 PM, Ben Pope
wrote: Hi,
I'm using the trivial logging interface, but I need to tweak the default configuration. I want to be able to flush after every log entry, and I also want to be able to do file rolling.
As far as I can tell, in order to configure it this way, I pretty much need to configure the whole thing from scratch including formatters, but I can't find the code that sets up the default logger to replicate it.
Any pointers?
Yes, you have to create and configure the sink yourself to do that. The default sink cannot be accessed. It is rather specialized and cannot be customized in any way, so it wouldn't be of use for you anyway.
The code for the default formatter and sink must exist somewhere for inspiration, no?
It's in libs/log/src/default_sink.cpp.
Thank you, I managed to get my new logs formatted similarly to the old ones. Ben
participants (2)
-
Andrey Semashev
-
Ben Pope