Table of Contents

Class GridForgeLogger

Namespace
GridForge
Assembly
GridForge.dll

Provides a configurable logging system for GridForge with support for log levels, formatting, and file output.

public static class GridForgeLogger
Inheritance
GridForgeLogger
Inherited Members

Properties

Channel

Gets the diagnostic channel used by GridForge logging.

public static DiagnosticChannel Channel { get; }

Property Value

DiagnosticChannel

CustomFormatter

Gets or sets the formatter used to transform log arguments into a final log entry. Assigning null restores DefaultLogFormatter(DiagnosticLevel, string, string).

public static Func<DiagnosticLevel, string, string, string> CustomFormatter { get; set; }

Property Value

Func<DiagnosticLevel, string, string, string>

DebugChannel

Gets the diagnostic channel used for verbose debug diagnostics.

public static DiagnosticChannel DebugChannel { get; }

Property Value

DiagnosticChannel

EnableDebugLogging

Gets or sets a value indicating whether verbose debug diagnostics should be emitted.

public static bool EnableDebugLogging { get; set; }

Property Value

bool

LogFilePath

Gets or sets the file path for logging. If null, file logging is disabled.

public static string? LogFilePath { get; set; }

Property Value

string

LogHandler

Gets or sets the delegate used to write formatted log messages. Assigning null restores DefaultLogHandler(DiagnosticLevel, string, string).

public static Action<DiagnosticLevel, string, string> LogHandler { get; set; }

Property Value

Action<DiagnosticLevel, string, string>

MinimumLevel

Gets or sets the minimum log level required for messages to be logged.

public static DiagnosticLevel MinimumLevel { get; set; }

Property Value

DiagnosticLevel

Methods

DefaultLogFormatter(DiagnosticLevel, string, string)

The default log formatter that formats log messages with timestamp, log level, and source information.

public static string DefaultLogFormatter(DiagnosticLevel level, string message, string source)

Parameters

level DiagnosticLevel

The severity level of the log message.

message string

The log message.

source string

The source of the log message.

Returns

string

A formatted log entry as a string.

DefaultLogHandler(DiagnosticLevel, string, string)

The default handler for logging messages, writing them to the console and optionally to a file.

public static void DefaultLogHandler(DiagnosticLevel level, string message, string source)

Parameters

level DiagnosticLevel

The severity level of the log message.

message string

The log message.

source string

The source of the log message.

IsEnabled(DiagnosticLevel)

Determines whether diagnostics at the specified level are currently enabled.

public static bool IsEnabled(DiagnosticLevel level)

Parameters

level DiagnosticLevel

The diagnostic level to evaluate.

Returns

bool

true when messages at level will be emitted; otherwise, false.