Std Phobos 2 and logging library?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Apr 11 07:02:56 PDT 2009


Frank Benoit wrote:
> Andrei Alexandrescu schrieb:
>> Zz wrote:
>>> Hi,
>>>
>>> Are there any plans for a logging library in Std Phobos 2.0?
>>>
>>> Zz
>> I wanted to add logging support for a while now but am undecided about
>> the API to use. Log4J is quite popular but quite complicated. There are
>> a number of simpler APIs out there but I couldn't figure out which is
>> the best.
>>
>> If anyone has ideas and/or code to contribute, that would be great.
>>
>>
>> Andrei
> 
> Why not start with the one from tango?

Because it's not my code and every discussion on licensing ends up 
confused. What we can do in Phobos is following e.g. the Log4J API, 
which as far as I understand Tango implements or at least draws 
inspiration from. But then by browsing this group a while ago I figured 
that Tango added a Trace module because some people deemed the logging 
API too complicated.

> Why has everything to be
> different?

Nobody said it has to be different.

> If it really is not important, why do you have to make it
> different than tango? Every code that uses tango and phobos, or wants to
> support both has to reimplemnent an intermediate abstraction layer.

Again, I don't *have* to make it different, but I can't *copy* it 
either. There are two other things to consider: (a) Phobos' logging can 
take advantage of D2 features; (b) Phobos' logging should be well 
integrated with the rest of itself, e.g. it may be odd to have one way 
to format things in stdio and an entirely different way in the log, or 
to have the logging infrastructure incompatible with the stream 
infrastructure.

That all being said, I don't see a lot of point in making Phobos' 
logging 100% identical with Tango's. Phobos2 and Tango2 will be usable 
together, so there's no point in the duplication - if you want Tango's 
logging mechanism, you just use it. So there will be no point in 
"supporting both" because both can coexist.


Andrei



More information about the Digitalmars-d mailing list