On Tuesday, 22 July 2014 at 10:24:33 UTC, linkrope wrote:
On Tuesday, 22 July 2014 at 09:51:24 UTC, ponce wrote:
On Tuesday, 22 July 2014 at 08:44:06 UTC, linkrope wrote:
On Tuesday, 22 July 2014 at 07:27:38 UTC, ponce wrote:
On Sunday, 20 July 2014 at 16:15:53 UTC, linkrope wrote:
By the way: Instead of what I really need, I get a
NullLogger.
I have no clue, why I never ever missed such an oddity.
I asked for it. And I use it, because I write libraries that
log warnings but don't forcefully require the users to
provide a Logger if they don't want to.
And that way, I can still write "logger.warningf" without
"if" everywhere.
But then it's better to provide no logger (or at least no
logger for level warning) than an artificial NullLogger.
My need is not "artificial", at least in my view.
Your opinion is different from mine. That's fine.
That's why we need someone to try to reconcile the many, many
opinions about this.
Not the need is artificial. For example, I have the need to
measure the performance of an application with and without
logging.
I think, the solution is artificial. The obvious solution would
be to register no logger at all.
This only works if you have a global set of registered loggers
(like your solution
https://github.com/linkrope/log/blob/master/src/log.d#L133).
The obvious flaw is that prevents to have a different logging
sink for different parts of a program. Now is it ever needed?
Yes, for topical logging (eg. "I want only log messages from
subsystem A", again real use case).
std.logger use the Composite pattern
http://en.wikipedia.org/wiki/Composite_pattern instead to allow
for a hierarchy.