<PackageReference Include="NLog" Version="6.2.2" />

NLog.LogEventInfo

public class LogEventInfo
Represents the logging event.
public static readonly DateTime ZeroDate

Gets the date of the first log event created.

public string CallerClassName { get; }

Gets the callsite class name

public string CallerFilePath { get; }

Gets the callsite source file path

public int CallerLineNumber { get; }

Gets the callsite source file line number

public string CallerMemberName { get; }

Gets the callsite member function name

public Exception Exception { get; set; }

Gets or sets the exception information.

public IFormatProvider FormatProvider { get; set; }

Gets or sets the format provider that was provided while logging or null when no formatProvider was specified.

public string FormattedMessage { get; }

Gets the formatted message.

public bool HasProperties { get; }

Checks if any per-event properties (Without allocation)

public bool HasStackTrace { get; }

Gets a value indicating whether stack trace has been set for this event.

public LogLevel Level { get; set; }

Gets or sets the level of the logging event.

public string LoggerName { get; set; }

Gets or sets the logger name.

public string Message { get; set; }

Gets or sets the log message including any parameter placeholders.

Gets or sets the message formatter for generating FormattedMessage Uses string.Format(...) when nothing else has been configured.

Gets the named parameters extracted from parsing Message as MessageTemplate

public object[] Parameters { get; set; }

Gets or sets the parameter values or null if no parameters have been specified.

public IDictionary<object, object> Properties { get; }

Gets the dictionary of per-event context properties.

public int SequenceID { get; }

Gets the sequence number for this LogEvent, which monotonously increasing for each LogEvent until int-overflow Marked obsolete with NLog 6.0, instead use ${counter:sequence=global} or ${guid:GeneratedFromLogEvent=true}

public StackTrace StackTrace { get; }

Gets the entire stack trace.

public DateTime TimeStamp { get; set; }

Gets or sets the timestamp of the logging event.

public StackFrame UserStackFrame { get; }

Obsolete and replaced by CallerMemberName or ${callsite} with NLog v5.3. Gets the stack frame of the method that did the logging.

public int UserStackFrameNumber { get; }

Gets the number index of the stack frame that represents the user code (not the NLog code).

public LogEventInfo()

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, string message)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, string message, IList<MessageTemplateParameter> messageTemplateParameters)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, string formattedMessage, string messageTemplate, IList<MessageTemplateParameter> messageTemplateParameters)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, string formattedMessage, string messageTemplate, ReadOnlySpan<MessageTemplateParameter> messageTemplateParameters)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, string message, IReadOnlyList<KeyValuePair<object, object>> eventProperties)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, IFormatProvider formatProvider, string message, object[] parameters)

Initializes a new instance of the LogEventInfo class.

public LogEventInfo(LogLevel level, string loggerName, IFormatProvider formatProvider, string message, object[] parameters, Exception exception)

Initializes a new instance of the LogEventInfo class.

public static LogEventInfo Create(LogLevel logLevel, string loggerName, string message)

Creates the log event.

public static LogEventInfo Create(LogLevel logLevel, string loggerName, IFormatProvider formatProvider, string message, object[] parameters)

Creates the log event.

public static LogEventInfo Create(LogLevel logLevel, string loggerName, IFormatProvider formatProvider, object message)

Creates the log event.

public static LogEventInfo Create(LogLevel logLevel, string loggerName, Exception exception, IFormatProvider formatProvider, string message)

Creates the log event.

public static LogEventInfo Create(LogLevel logLevel, string loggerName, Exception exception, IFormatProvider formatProvider, string message, object[] parameters)

Creates the log event.

public static LogEventInfo CreateNullEvent()

Creates the null event.

public void SetCallerInfo(string callerClassName, string callerMemberName, string callerFilePath, int callerLineNumber)

Sets the details retrieved from the Caller Information Attributes

public void SetStackTrace(StackTrace stackTrace)

Sets the stack trace for the event info.

public void SetStackTrace(StackTrace stackTrace, int userStackFrame)

Sets the stack trace for the event info.

Creates AsyncLogEventInfo from this LogEventInfo by attaching the specified asynchronous continuation.