July 19, 2015 Customization of User Defined Logger | ||||
|---|---|---|---|---|
| ||||
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
| ||||
July 19, 2015 Re: Customization of User Defined Logger | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Suliman | 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:
http://dlang.org/phobos/std_experimental_logger_core.html#.Logger.this
> If I am write I think that this example should be extended.
The documentation needs some help. :)
Ali
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply