Review: std.logger

Robert burner Schadek via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 12:35:13 PDT 2014


On Tuesday, 15 July 2014 at 17:41:09 UTC, Jeremy Powers via 
Digitalmars-d wrote:
>>
>> Will you then be able to get fully inlined low overhead 
>> ringbuffer logging
>>> throughout the application and used frameworks? E.g. do low 
>>> level logging
>>> to a ringbuffer that is only saved/mailed upon fatal crashes. 
>>> This is
>>> useful for online services.
>>>
>>
>> Yes, apart from the inlined part, I'm not sure what the 
>> compiler does with
>> virtual functions.
>>
>
> But can you do it without modifying the user code?
>
> Ideally, one could control how logging happens without having 
> to change the
> code that requests the logging.  This is important for cases 
> like when you
> have a library that uses logging, and you need to make it 
> conform without
> digging into its guts.

If the user uses the defaultLogger it is trivial. Otherwise if 
you get the logger by calling a factory function you maintain. It 
is also trival.

>
> I believe to do this with the current setup, you would need 
> some standard
> 'dispatcher' logger, and have every user of logging use it.  
> Then could
> configure the dispatcher as needed for your case without 
> modifying all the
> code to use a different logger.

Sounds like a MultiLogger as defaultLogger
>
> Ideally this standard setup would be the default/recommended 
> way to use the
> logging library - any thoughts on how to do this properly (and 
> maybe get
> inlining/templating)?

I think the default way depends on your use case. If it is forced 
its properly to flexible enough


More information about the Digitalmars-d mailing list