Implementing std.log

Jacob Carlborg doob at me.com
Sun May 15 08:22:09 PDT 2011


On 2011-05-14 22: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.
>
>> 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

The obvious solution would be to have the logging functions returning an 
interface, Logger, but interfaces seem to be banned from Phobos. Ok, I 
see now, since templates are used this can be a problem. Hmm, templates 
are used EVERYWHERE in Phobos.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list