Voting: std.logger

Kevin Lamonte via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 3 15:34:28 PDT 2014


On Wednesday, 3 September 2014 at 13:13:31 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 3 September 2014 at 11:39:59 UTC, Kevin Lamonte 
> wrote:
>> This could also be split into traceFnEnter, 
>> traceFnExitSuccess, and traceFnExitFailure with LogEntry.args 
>> set to indicate which one (">", "<", "!<" for example) and a 
>> mixin provided so that client code could get it all in a 
>> one-liner.
>
> Sounds like a candidate for an attribute, just prefix a 
> function or function call with @trace(level)?

I've got a feature request in for just that: 
https://issues.dlang.org/show_bug.cgi?id=13406

While thinking about it I realize that it's actually very easy to 
generalize @trace into the equivalent of Common Lisp :before, 
:after, and :around methods: @scope(&scopeFn) .  (It would work 
even better if scope(success) and scope(failure) exposed what 
they are returning/throwing.)

In the meantime Log4D has a (barely tested) mixin.


More information about the Digitalmars-d mailing list