Implementing std.log

Robert Clipsham robert at octarineparrot.com
Sat May 14 14:06:42 PDT 2011


On 14/05/2011 21:37, Andrei Alexandrescu wrote:
> 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.

In which case, wouldn't xyz alone be better? Then you have std.log.info, 
etc. Renamed imports can be used to get log.info etc.

>> 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).

Fair enough. I keep asking as it's essential functionality for me.

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list