namespace Tapeti.Serilog { /// /// Collects diagnostic information for message handler logging when using the /// MessageHandlerLogging middleware. /// /// /// Similar to IDiagnosticContext in Serilog.Extensions.Hosting but slightly extended. /// public interface IDiagnosticContext { /// /// Set the specified property on the current diagnostic context. The property will be collected /// and attached to the event emitted at the completion of the context. /// /// The name of the property. Must be non-empty. /// The property value. /// If true, the value will be serialized as structured /// data if possible; if false, the object will be recorded as a scalar or simple array. void Set(string propertyName, object value, bool destructureObjects = false); /// /// Resets the timer which is used to monitor how long a message handler takes to complete. /// Useful for example when a message handler is throttled by a rate limiter in the message /// handler method and you want to measure only the time taken after it is allowed to start. /// /// If true, the time taken until this reset is added to this diagnostic context as an incrementally named property for logging purposes. The value will be the time in milliseconds. /// The prefix for the property name(s) when addToContext is true. The number of times ResetStopwatch is called will be appended (stopwatchReset1, stopwatchReset2, etc). void ResetStopwatch(bool addToContext = true, string propertyNamePrefix = "stopwatchReset"); } }