Structured logging (was Early review of std.logger)
Dicebot
public at dicebot.lv
Tue Oct 15 08:57:35 PDT 2013
On Tuesday, 15 October 2013 at 15:53:34 UTC, Robert Schadek wrote:
> That been said, you can add it. The method Logger.logf is a
> variadic
> template. You can simple create your own Logger Class and
> overwrite that
> method and implemented your structured logging approach there.
> The only
> pitfall is that you need a ref of type
> WhateverYourLoggerClassIsCalled
> and call logf on that or you fall back to the default logf
> implementation provided by the Logger class. Another way would
> be to
> parse the message passed to logMessage and go from there.
>
> Long story short. Global default Logger means structured logging
> requires parsing. All other logger require correct reference
> type of logger.
I don't think it is a good design to conflate logging mode with
output mode in a single logger class. I'd prefer to see log() as
variadic structured logger and logf() as it is now (making
conditional logger `logIf()`)
More information about the Digitalmars-d
mailing list