Table of Contents

Class GravitasLogger

Namespace
Gravitas
Assembly
Gravitas.dll

Provides centralized diagnostics for Gravitas runtime code.

public static class GravitasLogger
Inheritance
GravitasLogger
Inherited Members

Remarks

Warning and error diagnostics are controlled through MinimumLevel. Trace-style diagnostics that were previously debug-only are additionally gated by EnableDebugLogging so hosts can opt into verbose runtime output explicitly.

Properties

Channel

Gets the diagnostic channel used for Gravitas warnings and errors.

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

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 severity required for non-debug diagnostics to be emitted.

public static DiagnosticLevel MinimumLevel { get; set; }

Property Value

DiagnosticLevel

Methods

DefaultLogFormatter(DiagnosticLevel, string, string)

Formats a Gravitas log entry using a deterministic, source-first layout.

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

Parameters

level DiagnosticLevel
message string
source string

Returns

string

DefaultLogHandler(DiagnosticLevel, string, string)

The default handler for Gravitas log messages.

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

Parameters

level DiagnosticLevel
message string
source string

IsEnabled(DiagnosticLevel)

Determines whether non-debug 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.