On Wednesday, 3 September 2014 at 22:34:30 UTC, Kevin Lamonte
wrote:
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.
This can already be implemented in a library if "mixin of an
implementation" idiom is used. I think it fits D style better
(having attributes modify actual code flow is unprecedented)