std.logger

develop32 develop32 at gmail.com
Thu Aug 22 09:01:16 PDT 2013


On Thursday, 22 August 2013 at 14:13:29 UTC, Robert Schadek wrote:
> 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.

Why logging functions accept only a string? I would expect it to 
behave as std.stdio with its variadic parameters.

It would be more straightforward to write logging code:

log("Moving ", data, " to ", destination);

Where 'data' and 'destination' are any variables. I use such 
setup in my projects and it helps greatly to identify what went 
wrong when not using a debugger.



More information about the Digitalmars-d mailing list