Skip to content

Log

Inherits object

Public Static Functions

void

Debug(object? message)

Writes a debug message to the log.

void

Message(object? message, bool omitTimestamp)

Writes a message to the log.

void

Message(object? message, LogLevel level, bool omitTimestamp)

Writes a message with a specific log level to the log.

void

Error(object? message, bool suppress)

Writes an error message to the log.

void

Error(Exception ex, bool suppress)

Writes an exception to the log.

void

Error(Exception ex, string message, bool suppress)

Writes an exception with an additional message to the log.

void

PostEvent(object? message, object? source, params string[] tags)

Posts a log event with the specified message, source, and tags.

void

PostEvent(object? message, object? source, LogLevel level, params string[] tags)

Posts a log event with the specified message, source, level, and tags.

void

PostEvent(object? message, object? source, LogLevel level, IEnumerable? tags)

Posts a log event with the specified message, source, level, and tags.

void

PostEvent(string message, string source, LogLevel level, IEnumerable? tags)

Posts a log event with the specified message, source, level, and tags.

void

InvokeOnMessage(object? message, LogLevel level, bool omitTimestamp)

Invokes the OnMessage event with the specified message and log level.

Private Functions

void

LogToFile(string logName, params string[] entries)

Writes log entries to a file.

Internal Functions

void

Write(TextWriter writer, object? message, LogLevel level, bool omitTimestamp)

Internal method for writing log messages to various outputs.

Public Attributes

LogInstance

Instance

Gets the singleton log instance.

string

OUTPUT_FOLDER

The name of the folder where log files are stored.

ColorTextWriter

StdOutErrorWriter

Text writer for error output with red color formatting.

Private Attributes

string

BASE_DIRECTORY

The base directory for log file storage.

Internal Attributes

JsonSerializerSettings

JSON_SETTINGS

JSON serialization settings used for log events.

Properties

static

bool

IncludeTimestamps

[get, set]

Gets or sets whether timestamps should be included in log output.

static

bool

ConsoleOutput

[get, set]

Gets or sets whether logs should be written to the console.

static

bool

FileOutput

[get, set]

Gets or sets whether logs should be written to files.

static

int

SuppressionCount

[get, set]

Gets or sets the count of suppressed error messages.

static

bool?

OverrideFileOutput

[get, set]

Internal override for file output behavior.

Events

Action

(string, LogLevel)

OnMessage

Event raised when a log message is written.

Action

(Event)

EventPosted

Event raised when a log event is posted.