Class FileLogger
- Namespace
- FishMMO.Logging
- Assembly
- FishMMO-Logger.dll
public class FileLogger : ILogger, IDisposable
- Inheritance
-
FileLogger
- Implements
- Inherited Members
Constructors
FileLogger(FileLoggerConfig, Action<string>)
public FileLogger(FileLoggerConfig config, Action<string> internalLogCallback = null)
Parameters
configFileLoggerConfiginternalLogCallbackAction<string>
Properties
AllowedLevels
Gets the set of log levels that this logger is allowed to process. If a log entry's level is not in this set, it will be ignored by this logger.
public IReadOnlyCollection<LogLevel> AllowedLevels { get; }
Property Value
HandlesConsoleParts
Gets a value indicating whether this logger is specifically designed to handle console output from the Log.WritePartsToConsole method. If true, this logger will be excluded from general dispatch when WritePartsToConsole has already sent output to the primary console formatter.
public bool HandlesConsoleParts { get; }
Property Value
IsEnabled
Gets whether this logger is currently enabled.
public bool IsEnabled { get; }
Property Value
Methods
Dispose()
Disposes the underlying StreamWriter, releasing file resources.
public void Dispose()
Log(LogEntry)
Logs a structured log entry asynchronously.
public Task Log(LogEntry entry)
Parameters
entryLogEntryThe log entry to record.
Returns
SetAllowedLevels(HashSet<LogLevel>)
Sets the specific log levels that this logger is allowed to process. Setting this will replace any previously configured allowed levels.
public void SetAllowedLevels(HashSet<LogLevel> levels)
Parameters
levelsHashSet<LogLevel>A HashSet containing the LogLevels to allow. If null or empty, no levels will be allowed.
SetEnabled(bool)
Sets the enabled state of the logger.
public void SetEnabled(bool enabled)
Parameters
enabledboolTrue to enable, false to disable.