Serilog.Events.LogEvent
A log event.
An exception associated with the event, or null.
The level of the event.
The message template describing the event.
Properties associated with the event, including those presented in MessageTemplate.
The id of the span that was active when the event was created, if any.
The time at which the event occurred.
The id of the trace that was active when the event was created, if any.
public LogEvent(DateTimeOffset timestamp, LogEventLevel level, Exception exception, MessageTemplate messageTemplate, IEnumerable<LogEventProperty> properties)
Construct a new LogEvent.
public LogEvent(DateTimeOffset timestamp, LogEventLevel level, Exception exception, MessageTemplate messageTemplate, IEnumerable<LogEventProperty> properties, ActivityTraceId traceId, ActivitySpanId spanId)
Construct a new LogEvent.
public static LogEvent UnstableAssembleFromParts(DateTimeOffset timestamp, LogEventLevel level, Exception exception, MessageTemplate messageTemplate, Dictionary<string, LogEventPropertyValue> properties, ActivityTraceId traceId, ActivitySpanId spanId)
Construct a LogEvent using pre-allocated values for internal fields. Normally,
the LogEvent constructor allocates a dictionary to back Properties,
so that this is not unexpectedly shared. This is unnecessary in many integration scenarios,
leading to an additional nontrivial Dictionary<T, U> allocation. This
method allows specialized callers to avoid that overhead.
Add a property to the event if not already present, otherwise, update its value.
Add a property to the event if not already present.
public void AddPropertyIfAbsent(ILogEventPropertyFactory factory, string name, object value, bool destructureObjects = false)
Add a property to the event if not already present.
Remove a property from the event, if present. Otherwise no action
is performed.
Render the message template to the specified output, given the properties associated
with the event.
Render the message template given the properties associated
with the event, and return the result.