Review: std.logger

Dragos Carp via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 13 07:25:41 PDT 2014


On Sunday, 13 July 2014 at 13:37:13 UTC, Robert burner Schadek
wrote:
> On Sunday, 13 July 2014 at 13:30:20 UTC, Dragos Carp wrote:
>>>
>>> But creating x , necessary, function with only slightly 
>>> different names is also very non idiomatic D code. Anyway I'm 
>>> working on that.
>>
>> For the conditional variants, wouldn't be enough an overload 
>> with
>> the condition on the first position?
>
> people hated it and writeln like logging makes this impossible 
> anyway

write/writeln are generic functions that are used for producing
plain-text output in line oriented format (.csv, etc.) or not
line oriented format (json, xml, etc.). This text is human
readable, but not necessary user friendly.

A logging facility need to produce both human readable and user
friendly messages.

I would prefer:
    info("%s is the answer", true);
instead of
    info(true, " is the answer");

The variant without format specifier also makes the
internationalization of the log entries almost impossible.


IMHO these are some good reasons why the logging facility should
not try to support the variants that the std.stdio with
write/f/ln provides.


More information about the Digitalmars-d mailing list