Review: std.logger

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 12 07:06:33 PDT 2014


Am Sat, 12 Jul 2014 13:18:29 +0000
schrieb "Robert burner Schadek" <rburners at gmail.com>:

> > * Can the logger be influenced by command line flags / 
> > environment
> >   variables? I guess not, but if it can it should be documented.  
> I thought not writing about it makes it clear that you can not.
> 
Yes, the documentation is OK in that regard, that was more a question
than a criticism about the docs ;-)


> > * Why does LogManager.defaultLogger return by ref instead of 
> > just using
> >   a setter?  
> Because I use the defaultLogger at quite a lot of places and 
> treating it as an property just felt right.

Yes, it's perfectly fine as a property. But why not:

static @property @trusted Logger defaultLogger() //getter
{
    return ...;
}

static @property @trusted void defaultLogger(Logger value) //setter
{
    myLogger = value;
}

Usage of the property is exactly the same, but an explicit setter is
more powerful and afaik we usually use explicit setters.


More information about the Digitalmars-d mailing list