Implementing std.log

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 14 13:37:12 PDT 2011


On 05/14/2011 02:50 PM, Robert Clipsham wrote:
> On 14/05/2011 18:04, Andrei Alexandrescu wrote:
>> On 5/9/11 1:52 AM, Andrei Alexandrescu wrote:
>> [snip]
>>
>> I updated my std.log draft. Added a lot of features including formatted
>> writing, delayed logging, and a variety of configuration options.
>> Replaced the redundant log.xyz with logXyz. The implementation is
>> getting close to reviewable form.
>>
>> Documentation:
>>
>> http://d-programming-language.org/phobos-prerelease/std_log.html
>>
>> Source:
>>
>> https://github.com/andralex/phobos
>>
>> Feedback welcome.
>>
>>
>> Thanks,
>>
>> Andrei
>
> I far prefered log.xyz to logXyz... The latter just looks ugly in my
> opinion.

There are a few problems with log.xyz. For one, std.log.log.info is 
terrible. Second, I found absolutely no justification to provide the 
dummy struct "log" just to keep five predefined logs in there. Them 
being individual entities allows the user to define their own logs with 
the same look and feel, e.g. logRemote.

> A also notice all those functions return FileLoggers, how will
> this work when other backends are supported?

I want to nail usability before extension. Extensibility can be provided 
via an indirection inside FileLogger (which should indeed receive a more 
appropriate name).


Andrei


More information about the Digitalmars-d mailing list