Implementing std.log

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 14 18:36:10 PDT 2011


On 5/14/11 6:43 PM, Michel Fortin wrote:
> On 2011-05-14 18:35:32 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> said:
>
>> On 05/14/2011 04:56 PM, Michel Fortin wrote:
>>> I'll also question whether they should be written to files at all by
>>> default (as opposed to stdin and stderr). I'm aware initLogging's
>>> documentation says: "If log­ging is ef­fected with­out hav­ing called
>>> this func­tion, all pa­ra­me­ters are at their de­fault val­ues and all
>>> log­ging is done only to stderr." So basically, I'll get what I want if
>>> I never call initLogging, but then I can't control verbosity and other
>>> settings using --v and other flags passed as arguments.
>>
>> A server app must log to files, no question about that. We'll need to
>> add rotation etc. in the future.
>
> No question about that.
>
> What I'm questioning is whether the typical use case for logging will be
> a server app. Ideally, I think we should encourage people to add logs
> everywhere it makes sense, if only as a debugging aid. If the default
> behaviour is to write logs to files it starts to look like a specialized
> tools for servers and such and it appears less relevant for other use
> cases.

In fact it may as well be the case that logging is for servers first. 
For casual use there's always writeln.

Andrei



More information about the Digitalmars-d mailing list