Table of Contents

Class FancyConsoleLoggerConfiguration

Namespace
Invex.Extensions.Logging.FancyConsole.Configuration
Assembly
Invex.Extensions.Logging.FancyConsole.dll

Configuration options for the fancy console logger. Bound from the Logging:FancyConsole configuration section when registered via AddFancyConsole(ILoggingBuilder), and can also be set programmatically via the AddFancyConsole(ILoggingBuilder, Action<FancyConsoleLoggerConfiguration>) overload.

[PublicAPI]
public sealed class FancyConsoleLoggerConfiguration
Inheritance
FancyConsoleLoggerConfiguration
Inherited Members

Remarks

Changes made to the bound configuration at runtime (for example, by editing appsettings.json) are picked up automatically and applied to subsequent log entries.

Fields

DefaultExceptionFormat

The default value of ExceptionFormat: Full.

public const FancyConsoleExceptionFormat DefaultExceptionFormat = Full

Field Value

FancyConsoleExceptionFormat

DefaultExceptionTextStyle

The default value of ExceptionTextStyle: "red1".

public const string DefaultExceptionTextStyle = "red1"

Field Value

string

DefaultIncludeScopes

The default value of IncludeScopes: false.

public const bool DefaultIncludeScopes = false

Field Value

bool

DefaultLayout

The default value of Layout: Standard.

public const FancyConsoleLayout DefaultLayout = Standard

Field Value

FancyConsoleLayout

DefaultLogToStandardErrorThreshold

The default value of LogToStandardErrorThreshold: None, which writes every entry to standard output.

public const LogLevel DefaultLogToStandardErrorThreshold = None

Field Value

LogLevel

DefaultTimestampFormat

The default value of TimestampFormat: null, which uses the layout's default format.

public const string? DefaultTimestampFormat = null

Field Value

string

DefaultUseColors

The default value of UseColors: true.

public const bool DefaultUseColors = true

Field Value

bool

DefaultUseShortCategoryName

The default value of UseShortCategoryName: false.

public const bool DefaultUseShortCategoryName = false

Field Value

bool

DefaultUseUtcTimestamp

The default value of UseUtcTimestamp: false.

public const bool DefaultUseUtcTimestamp = false

Field Value

bool

Properties

ExceptionFormat

Gets or sets how exceptions attached to log entries are rendered. Defaults to DefaultExceptionFormat (Full).

public FancyConsoleExceptionFormat ExceptionFormat { get; set; }

Property Value

FancyConsoleExceptionFormat

ExceptionTextStyle

Gets or sets the Spectre.Console style string used for Full and Summary exception text. A null or whitespace value disables styling; a value that is not a valid style uses DefaultExceptionTextStyle. Defaults to DefaultExceptionTextStyle ("red1").

public string? ExceptionTextStyle { get; set; }

Property Value

string

IncludeScopes

Gets or sets whether active logging scopes are shown after the category, separated by => , in the Standard and SingleLine layouts. Detailed always shows scopes and Minimal never does. Defaults to DefaultIncludeScopes (false).

public bool IncludeScopes { get; set; }

Property Value

bool

Remarks

Message-template scopes (for example, logger.BeginScope("Order {OrderId}", 42)) are shown as their formatted text. Other key/value scopes are shown as comma-separated Key=Value pairs, and any other scope object is shown using ToString(). Null and empty scopes are skipped.

Layout

Gets or sets how each log entry is laid out. Defaults to DefaultLayout (Standard).

public FancyConsoleLayout Layout { get; set; }

Property Value

FancyConsoleLayout

LevelStyles

Gets or sets per-LogLevel Spectre.Console style strings (for example, "bold red", "#ff8800", or "black on yellow") used for each entry's level-colored text. A mapped null or whitespace value disables styling for that level. Missing levels and values that are not valid styles use the built-in defaults: grey (Trace), seagreen3 (Debug), skyblue1 (Information), gold1 (Warning), darkorange (Error), and fuchsia (Critical). Empty by default.

public Dictionary<LogLevel, string?> LevelStyles { get; set; }

Property Value

Dictionary<LogLevel, string>

LogToStandardErrorThreshold

Gets or sets the minimum level written to standard error instead of standard output. Defaults to DefaultLogToStandardErrorThreshold (None), which writes every entry to standard output.

public LogLevel LogToStandardErrorThreshold { get; set; }

Property Value

LogLevel

TimestampFormat

Gets or sets a .NET date and time format string for entry timestamps, formatted with the invariant culture. When null or empty (the default), the layout's default is used: HH:mm:ss.fff for Standard and SingleLine, and yyyy-MM-dd HH:mm:ss.fff zzz for Detailed. The Standard header line always shows the date and UTC offset. Ignored by Minimal.

public string? TimestampFormat { get; set; }

Property Value

string

UseColors

Gets or sets whether level and exception styles are applied. When false, all output is written without styling, including Pretty exceptions. Defaults to DefaultUseColors (true).

public bool UseColors { get; set; }

Property Value

bool

Remarks

Even when enabled, colors are only emitted if the console supports them. Spectre.Console detects terminal capabilities and honors the NO_COLOR environment variable.

UseShortCategoryName

Gets or sets whether categories are shortened to the text after their last . (for example, MyApp.Services.OrderService becomes OrderService). Defaults to DefaultUseShortCategoryName (false).

public bool UseShortCategoryName { get; set; }

Property Value

bool

UseUtcTimestamp

Gets or sets whether timestamps are shown in UTC rather than local time. Defaults to DefaultUseUtcTimestamp (false).

public bool UseUtcTimestamp { get; set; }

Property Value

bool