Reputation: 125
I would like to ask if it possible to override the log methods or create a new one with extra properties in the method.
at the moment you can use it:
GlobalContext.Properites["Details"] = "some Info";
Log.Error("Some info",Exception);
I would like to use it:
Log.MySpecialError(Details, Message, Exception);
any advice will be appreciated
Ori
Upvotes: 1
Views: 2529
Reputation: 18162
Create your own extension method.
It must be defined in a static class, and be a static method. E.g.
Definitions:
public static class Log4NetExtensions
{
public static void MySpecialError(this Log log, string details, string message, Exception exception)
{
//Do something with parameters
}
}
Use:
Log.MySpecialError(details, message, ex);
Upvotes: 5