Struct LogMessage
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
Provides a message object used for logging purposes.
public readonly struct LogMessage
- Inherited Members
Constructors
LogMessage(LogSeverity, string, string?, Exception?)
Initializes a new LogMessage struct with the severity, source, message of the event, and optionally, an exception.
public LogMessage(LogSeverity severity, string source, string? message, Exception? exception = null)
Parameters
severity
LogSeverityThe severity of the event.
source
stringThe source of the event.
message
stringThe message of the event.
exception
ExceptionThe exception of the event.
Properties
Exception
Gets the exception of this log entry.
public Exception? Exception { get; }
Property Value
Message
Gets the message of this log entry.
public string? Message { get; }
Property Value
- string
A string containing the message of this log entry.
Severity
Gets the severity of the log entry.
public LogSeverity Severity { get; }
Property Value
- LogSeverity
A LogSeverity enum to indicate the severeness of the incident or event.
Source
Gets the source of the log entry.
public string Source { get; }
Property Value
- string
A string representing the source of the log entry.
Methods
ToString()
Returns a string representation of this log message.
public override string ToString()
Returns
- string
A string representation of this log message.
ToString(StringBuilder?, bool, bool, DateTimeKind, int?)
Returns a string representation of this log message.
public string ToString(StringBuilder? builder = null, bool fullException = true, bool prependTimestamp = true, DateTimeKind timestampKind = DateTimeKind.Local, int? padSource = 11)
Parameters
builder
StringBuilderThe string builder to use.
fullException
boolWhether to include the full exception in the string.
prependTimestamp
boolWhether to prepend the timestamp to the string.
timestampKind
DateTimeKindThe kind of timestamp to use.
padSource
int?The amount of padding to use for the source.
Returns
- string
A string representation of this log message.