Use this code for custom log levels:
log.Logger.Log(log.Logger.Name, Level.CRITICAL, "oops!", null);
Check the help file for predefined levels, or you can make your own
custom levels:
Level Catastrophic = new Level(130000, "CATASTROPHIC");
log.Logger.Log(log.Logger.Name, Catastrophic, "oops!", null);
I'm not sure how to specify this custom level in the configuration file
though, but there's plenty of predefined levels to play with.
Regards,
Dag
-----Original Message-----
From: Jaroslaw Kowalski [mailto:[EMAIL PROTECTED]
Sent: 18. mars 2005 16:12
To: Log4NET User
Cc: [EMAIL PROTECTED]
Subject: Re: Log4Net only for the committed techies
(...)
>> LogLevel level = LogLevel.Debug;
>>
>> logger.Log(level, "aaaa");
>
> Is this high level programmer? I'd be curious where this may be
useful.
> I see it as another local variable that I need to keep track of.
It may be useful when you're wrapping NLog with some other logging
layer, which is not so uncommon. Otherwise you'd have to use a switch:
switch (...)
{
case Debug: log.Debug(...); break;
case Error: log.Error(...); break;
case Fatal: log.Fatal(...); break;
case Info: log.Info(...); break;
...
}
Jarek