Welcome
Last updated
Was this helpful?
Waystone.WideLogEvents is a set of libraries inspired by Logging Sucks - by Boris Tane. This package provides a way for capturing and managing a set of properties throughout a logical scope, which can then be enriched into your log events.
A wide log event is a pattern where instead of logging many small, disconnected events, you accumulate relevant information throughout a process (like a HTTP request) and log it all at once at the end. This makes it much easier to correlate data and understand the full context of an operation.
The central point for managing properties within a scope. It uses AsyncLocal to ensure properties are correctly tracked across async calls.
A disposable scope that manages the lifecycle of properties. When a scope is created, it starts a new set of properties. When disposed, it restores the previous scope's properties.
Wrap your operation in a WideLogEventScope
using (var scope = WideLogEventContext.BeginScope())
{
// Your code here
}You can push properties to the current scope at any time
Last updated
Was this helpful?
Was this helpful?
WideLogEventContext.PushProperty("CustomerId", 12345);
WideLogEventContext.PushProperty("OrderDetails", new { Total = 100.00, ItemCount = 3 });