std.logger

Johannes Pfau nospam at example.com
Thu Aug 22 08:06:32 PDT 2013


Am Thu, 22 Aug 2013 16:00:06 +0200
schrieb Robert Schadek <realburner at gmx.de>:

> I'm still missing a logging facility in D and as the last attempt seam
> to have stopped I want to throw
> in my version. After reading through the std.log thread I made my
> conclusions and created my own
> logger. People seamed to be unhappy with the naming and the way of
> configuration.
> Additionally when to throw or not to throw seamed to be an argument.
> 
> My attempt is to provide a very small functional interface to logging.
> IMO it is impossible to fulfill
> all requirements a D developer can have through configuration classes
> and such, I designed the
> a abstract Logger class that can be easily implemented to one's own
> needs.
> 
> As a quick start feature I created a Stdio- and File-Logger. If no
> Logger is provided to the log
> function a defaultLogger will be used.
> 
> Docu:
> http://burner.github.io/phobos/phobos-prerelease/std_logger.html
> 
> Pull Request:
> https://github.com/D-Programming-Language/phobos/pull/1500
> 
> 
> I hope this will lead to some progress in phobos, when it comes to
> message logging.
> 

It would be nice to finally have logging in phobos.
Two small nit-picks:

The API doesn't follow the phobos naming conventions: functions (error,
fatal, ...) need to start with a lowercase letter. Same for enum
members. See http://dlang.org/dstyle.html

I guess the function string for writeLogMsg is fully-qualified? I'd
like to see module and function split into two parts. Or fully-qualified
function + module so the fully qualified function name can be sliced to
strip the module name: auto fn = func[module.length .. $]


More information about the Digitalmars-d mailing list