www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Customization of User Defined Logger

reply "Suliman" <evermind live.ru> writes:
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
Jul 19 2015
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 07/19/2015 06:02 AM, Suliman wrote:

 When I try co compile next code:

 class MyCustomLogger : Logger
 {
      this(string newName, LogLevel lv)  safe
      {
          super(newName, lv);
According to (and despite :p) its documentation Logger's constructor takes just a LogLevel:
 If I am write I think that this example should be extended.
The documentation needs some help. :) Ali
Jul 19 2015