Implementing std.log

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 14 16:55:11 PDT 2011


On 05/14/2011 06:36 PM, Michel Fortin wrote:
> On 2011-05-14 18:33:06 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> said:
>
>> On 05/14/2011 05:17 PM, Jonathan M Davis wrote:
>>> On 2011-05-14 14:56, Michel Fortin wrote:
>>>> I'd even go further and question whether it makes sense to have info,
>>>> warning, and errors be written to separate files.
>>>
>>> I'd definitely vote for them all to be in the same file, but I don't
>>> generally
>>> see much benefit in having multiple log files. I like having them all
>>> in one
>>> place where you can see what happened in what order. Having them in
>>> separate
>>> log files is just going to make it harder to figure out what
>>> happened, and I
>>> think that it would become tempting (for me at least) to just log
>>> everything
>>> at exactly the same level so that they ended up in the same file.
>>
>> The info log contains log messages for all levels.
>
> That's better then, even though it's not very obvious. Perhaps it should
> be called "all" instead of "info". Is that stated somewhere in the
> documentation? I seem to have missed it.

http://d-programming-language.org/phobos-prerelease/std_log.html

"Any message logged at a given severity is also logged in logs of lesser 
severity. Logging to the fatal log always terminates the application 
after logging. Logging to the critical log always throws an exception 
after logging."

Unless we fix a painful design mistake of glog, I'd keep names as they 
are. I did diverge from their API with the "critical" log, which throws. 
Google doesn't use exceptions so they didn't need a critical log.


Andrei


More information about the Digitalmars-d mailing list