[Issue 15536] [std.experimental.logger] More detailed example for custom logger implementation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 18 14:23:24 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=15536

Atila Neves <atila.neves at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |atila.neves at gmail.com

--- Comment #4 from Atila Neves <atila.neves at gmail.com> ---
This worked as expected for me and only logged a string:

------------------------------
import std.experimental.logger.filelogger;
import std.experimental.logger.core;

class MyLogger : FileLogger {
    this(in string fn) @safe { super(fn); }
    override protected void writeLogMsg(ref LogEntry payload) {
        logMsgPart(payload.msg);
    }
}

void main() {
    sharedLog = new MyLogger("/tmp/logger.txt");
    log("foobar");
}
------------------------------

--


More information about the Digitalmars-d-bugs mailing list