Early review of std.logger

Dicebot public at dicebot.lv
Mon Oct 14 05:45:05 PDT 2013


My own few comments from quick overview of the documentation 
(must admit I did not pay much attention to previous logger 
discussion threads).

=== critical ===

1)

I don't like forced verbosity of mentioning logging levels. In my 
opinion logging is one place where laconic syntax elegance really 
helps. Would have been nice to have `error(...)` as an alias to 
`log(LogLevel.Error, ...)` etc.

2)

I don't like that default `log` function outputs conditionally. 
It is rather unexpected and less frequent use case. I think 
current `logf` should become `log` and current `log` turn into 
`logIf` (with matching `errorIf`, `debugIf` etc.)

3)

Simple way to define multiple loggers as default ones is missing. 
As far as I understand, currently it can be done by creating own 
Logger which embeds multiple simple ones and registering it as 
default in LogManager. I think such common task should have 
built-in solution.

=== possible features? ===

One interesting addition would be to embed module name into 
logger call and provide facilities to filter output on per-module 
basis (similar to log level). D introspection tools should allow 
to do that with no observable API complication.


More information about the Digitalmars-d mailing list