When using LogWriterBase
just simply implement the WriteMessage() method. Example:
class PostSharpNLogWriter : LogWriterBase
{
// PostSharp+nlog _logger;
public PostSharpNLogWriter()
{
// initialize PostSharp+nlog here
// _logger = PostSharp+nlog.Create();
}
protected override void WriteMessage(string message)
{
// use PostSharp+nlog to write already formatted log message
//_logger.Log(message);
}
}
If you want to customize the logger, override the Write
method and add desired logic there. When you are done with your code, call either base.Write
which will format the message and issues WriteMessage
or call the WriteMessage
directly yourself.