Table of Contents

Class LoggerFactory

Namespace
Shard.Logger
Assembly
Shard.Logger.dll

Factory for creating and configuring Shard loggers. Centralizes all logging setup.

public static class LoggerFactory
Inheritance
LoggerFactory
Inherited Members

Methods

Configure(LogLevel, LogLevel?, string?, int)

Configure the global logging system with pretty console output and rolling file logs.

public static void Configure(LogLevel minimumLevel, LogLevel? fileMinimumLevel = null, string? logDirectory = null, int maxArchiveDays = 14)

Parameters

minimumLevel LogLevel

Minimum log level to output to the console.

fileMinimumLevel LogLevel

Minimum log level to write to file. Defaults to NLog.LogLevel.Trace so the file always captures everything, regardless of what's shown on screen.

logDirectory string

Directory to write log files to. Defaults to a "logs" folder next to the executable.

maxArchiveDays int

How many days of archived log files to retain. Defaults to 14.

ForCaller(string)

Get or create a logger for the caller's name. To define your own name, use GetLogger(string) instead.

public static IShardLogger ForCaller(string name = "")

Parameters

name string

Returns

IShardLogger

ForEnclosingClass()

Get or create a logger for the caller's name. To define your own name, use GetLogger(string) instead.

public static IShardLogger ForEnclosingClass()

Returns

IShardLogger

GetLogger(string)

Get or create a logger for the given name.

public static IShardLogger GetLogger(string name)

Parameters

name string

Returns

IShardLogger

Shutdown()

Flush and shutdown the logging system.

public static void Shutdown()