Table of Contents

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 LogSeverity

The severity of the event.

source string

The source of the event.

message string

The message of the event.

exception Exception

The exception of the event.

Properties

Exception

Gets the exception of this log entry.

public Exception? Exception { get; }

Property Value

Exception

A Exception object associated with an incident; otherwise null.

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 StringBuilder

The string builder to use.

fullException bool

Whether to include the full exception in the string.

prependTimestamp bool

Whether to prepend the timestamp to the string.

timestampKind DateTimeKind

The 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.