Posts

Showing posts with the label logging

On Serilog 'log enrichment' feature

This brief note is for .NET developers who use Serilog (great tool, by the way!) for logging implementations. I want to cover a very powerful, though rarely spoken of, feature - 'log enrichment'. It is an interesting concept and implementation which they describe as 'log events can be enriched with properties in various ways'. The main idea is that whatever log event gets written, it may be improved with custom data coming from various sources. So, what implementing log enrichers would give and how may it be applied? The first thing to mention is that neither business code, nor application code is designed to produce logs; it has a completely different purpose. The less logging code we have inside our business and application code, the cleaner, less coupled, and more cohesive our code is. Those working with enterprise code are quite used to code 'spiced up' with logging statements. While 'what and when' to log and 'what and when' not to log is a...