I want to inject a type-information to the log-call, like
public sealed class Logger
{
private readonly log4net.ILog _logger;
public Logger()
{
// somehow assing this._logger ... doesn't matter actually
}
public void Info<T>(string message)
{
if (!this._logger.IsInfoEnabled)
{
return;
}
var typeOfT = typeof (T);
var typeName = typeOfT.FullName;
// how to set a property here, only for this one single call
// which i can reference in the config
this._logger.Info(message);
}
}
The comment makes it clear: at some point I’d like to inject the FullName of my generic-parameter only for this one specific call.
I am using log4net 1.2.11.0
Actually it’s pretty simple: