Review: std.logger

Robert burner Schadek via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 24 06:05:03 PDT 2014


On Wednesday, 23 July 2014 at 17:56:52 UTC, linkrope wrote:
>
> Indeed: that's why the lazy condition should be evaluated last!
>
> Your "will log" condition is very simple and efficient: only >= 
> and !=
> But you cannot know, how long the evaluation of the 
> user-provided condition will take.

I believe this is a matter of opinion. From what I have seen the 
condition is usually very easy to computer and does not justify 
turning it into a delegate.

>
> BTW: with 'globalLogLevel', 'defaultLogger.logLevel'and 
> 'LogLevel.off' the usual 'willLog' predicate will come in handy 
> to avoid code duplication.

Why didn't you start your review with something useful like this?

>
> While the lazy evaluation of the condition would be the only 
> advantage over
>
>     if (condtion) log(...);
>
> I haven't encountered a single opportunity for conditional 
> logging in the code of our company.
>

All swans are white!


More information about the Digitalmars-d mailing list