Customization of User Defined Logger

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 19 06:02:38 PDT 2015


When I try co compile next code:

class MyCustomLogger : Logger
{
     this(string newName, LogLevel lv) @safe
     {
         super(newName, lv);
     }

     override void writeLogMsg(ref LogEntry payload)
     {
         // log message in my custom way
     }
}

auto logger = new MyCustomLogger();
logger.log("Awesome log message");

I am getting error:
logger.d(10): Error: constructor 
std.experimental.logger.core.Logger.this (LogLe
vel lv) is not callable using argument types (string, LogLevel)
logger.d(19): Error: undefined identifier lv

it's seems that I need to pass to constructor path with type 
string and LogLevel lv. But what it is?

If I am write I think that this example should be extended.


[1] http://dlang.org/library/std/experimental/logger.html


More information about the Digitalmars-d-learn mailing list