Voting: std.logger

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 19:19:19 PDT 2014


On 07/29/2014 07:11 AM, Dicebot wrote:
> 1) Yes / No for inclusion into std.experimental
>
> At this point please consider if module has functionality you want to
> see in standard library in general and if implementation is not
> fundamentally broken. This is a simple sanity check.
Not yet
>
> 2) Yes / No for inclusion into Phobos in its current state
>
No, as much as I'd like to have logging facilities in phobos, there are 
too many outstanding issues.
> This is where you should summarize your concerns raised during review if
> there are any and make decision if existing API / architecture are
> promising enough to be set in stone via Phobos inclusion.
>
> 3) If you have answered "No" for (2) :  list of mandatory changes that
> are needed to make you vote "Yes"

Get rid of the 8 different suffixes.
I only see the need for log and logf, why is the rest needed?

    log -> log(lazy Args args);
   logl -> log(LogLevel, lazy Args args);

   logf -> logf(string fmt, lazy Args args);
  loglf -> logf(LogLevel, string fmt, lazy Args args);

   logc -> if (cond) log(lazy Args args);
  loglc -> if (cond) log(LogLevel, lazy Args args);

  logcf -> if (cond) log(string fmt, lazy Args);
loglcf -> if (cond) log(LogLevel, string fmt, lazy Args);

You cannot use version identifiers to selectively disable functionality 
or people would have to compile their own phobos library for every set 
of version combinations.

Support duck-typing for the log functions.
Logger should be a concept and log functions should be free-standing 
UFCS functions that take any `isLogger!T`.
To support a global `defaultLog` variable, you could add a Logger 
interface and a loggerObject shim. See 
http://dlang.org/phobos/std_range.html#inputRangeObject for this a pattern.

The code could be consolidated and some classes could go.
This would probably result in 1-2KLOC, so this could be a single module 
instead of a package.

>
> 4) Any additional comments for author.
>
> Please separate (3) from (4) in some obvious fashion to make it possible
> for author to prioritize of feedback. Please use linked thread for
> discussions and only post vote + summary here.
>
> Currently only answer for (1) affects the voting outcome. Other answers
> are necessary to eventually  prepare std.logger for second voting during
> beta period of some future release (for actual inclusion into Phobos).
>
> If you have any comments / proposals about actual voting procedure or
> review process please create separate thread.
>
> Go ahead ;)



More information about the Digitalmars-d mailing list