Class LoggerFactory
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
minimumLevelLogLevelMinimum log level to output to the console.
fileMinimumLevelLogLevelMinimum log level to write to file. Defaults to NLog.LogLevel.Trace so the file always captures everything, regardless of what's shown on screen.
logDirectorystringDirectory to write log files to. Defaults to a "logs" folder next to the executable.
maxArchiveDaysintHow 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
namestring
Returns
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
GetLogger(string)
Get or create a logger for the given name.
public static IShardLogger GetLogger(string name)
Parameters
namestring
Returns
Shutdown()
Flush and shutdown the logging system.
public static void Shutdown()