Delegate LogEventInterceptor
Use this delegate for filtering, inspecting, or modifying log events immediately before they are emitted by ConsoleJsonLogExporter or one of the other log exporters in the Neon.Diagnostics namespace.
Namespace: Neon.Diagnostics
Assembly: Neon.Common.dll
Syntax
public delegate void LogEventInterceptor(LogEvent logEvent)
Parameters
Type | Name | Description |
---|---|---|
LogEvent | logEvent | The log event. |
Remarks
note
IMPORTANT: LogEvent record instances are reused by the Neon telemetry code, so you'll need to call Clone() when you're using the interceptor to collected logged events for later analysis (i.e. when unit testing).
You can configure an interceptor in ConsoleJsonLogExporterOptions or the options for other log exporters in the Neon.Diagnostics namespace. This is useful for unit tests that verify that code is logging events correctly.
You can also use this to modify the event in other ways like modifing the body, timestamp, labels, resources, etc. before the event is emitted.