@mythz, just wondering if a PR to the
ILog interface / implementations would be welcomed or not.
As a user (and a fan) of serilog’s message template-based structured logging in my apps I miss the ability to add properties to my logging when using native SS logging.
Currently the following methods are available from the interface for Debug as an example
void Debug(object message); void Debug(object message, Exception exception); void DebugFormat(string format, params object args);
Would adding the following method signature for each LogLevel to the interface be welcomed?
void Debug(Exception exception, string nessage, params object properties);
This would allow implementations such as Serilog and recent versions of nlog (or any others I’m not aware of) to utilise some of their structured logging capabilities.
going further than type scoping
LogManager.GetLogger(typeof(MyType)) (but more complex to implement no doubt) by adding a ‘context’ to the
ILog interface would allow properties to be added outwith the message template, or just appended to log message strings for implementations that don’t support structured logging either directly or scoped via a similar concept to serilog’s enrichers.
ILog ForContext(string propertyName, object value, bool destructureObjects = false); ILog ForContext(ILogEnricher enricher);
hope that makes sense