On 2014-12-04 02:10, Martin Nowak wrote:
I just found a very compelling alternative solution to the LogLevel
disabling problem. This was one of the reasons for the delay of std.log
and the current solution still isn't great [1].
This idea here achieves
- fine grained control over log levels (per module/package)
- zero overhead for statically disabled log levels
- zero (almost) boilerplate (works even with the global stdlog)
- and it establishes a nice convention to enable logging for a library
`pkg.logLevel = LogLevel.info;`
Basically it works by declaring a logLevel in a module or package.
Then the std.logger module does a reverse lookup of that declaration.
This is kind of cool that you can do in D, but it feels like a hack. I
have stopped following the std.log thread, could you summarize what
issues you're having and trying to solve and why not a more obvious
solution doesn't work?
--
/Jacob Carlborg