Class LogAsTraceProcessor
This OpenTelemetry processor submits any logged events that satisfy a log level as trace events to the current trace span (if any). This is an easy way to converge logging any tracing while we're waiting for the OpenTelemetry folks support this natively.
Namespace: Neon.Diagnostics
Assembly: Neon.Common.dll
Syntax
public class LogAsTraceProcessor : BaseProcessor<LogRecord>
Remarks
This is very easy to use. Simply call AddLogAsTraceProcessor(OpenTelemetryLoggerOptions, Action<LogAsTraceProcessorOptions>), optionally passing options that specify the log level for events to be added as trace events.
Constructors
LogAsTraceProcessor(LogAsTraceProcessorOptions)
Constructs a processor that forwards logged events to the current trace as trace events.
Declaration
public LogAsTraceProcessor(LogAsTraceProcessorOptions options)
Parameters
Type | Name | Description |
---|---|---|
LogAsTraceProcessorOptions | options | Optionally specifies the processor options. This is used to filter the events logged to as trace events by LogLevel. This defaults to forwarding events with log levels greater than or equal to LogLevel.Information. |
Remarks
All log events added as events in the current span will have their name set to Log and will also include the log event tags but with their names prefixed by "neon.log." to avoid conflicts with unrelated tags.
Methods
OnEnd(LogRecord)
Handles the event forwarding.
Declaration
public override void OnEnd(LogRecord logRecord)
Parameters
Type | Name | Description |
---|---|---|
LogRecord | logRecord | The log record. |