std.logger

Robert Schadek realburner at gmx.de
Thu Aug 22 10:08:53 PDT 2013


On 08/22/2013 05:59 PM, Jacob Carlborg wrote:
> My suggestion is you define a single function "log". This returns an
> instance of the current/default logger. The logger, be it a struct or
> class, have one method for each logging level. The default logging
> level would use opCall, resulting in this API:
>
> log("asd"); // log with default level
> log.warning("foo"); // log with warning level
> log.error("asd"); //
>
> And so on. Then you would only have one function at the module level.
>
I like this part. But you will still need two more module level function
to set and get the global LogLevel. And log would have to return by ref
to assign a new defaultLogger.
But still, I like that very much, even though this is still in conflict
with std.math.log.


More information about the Digitalmars-d mailing list