Table of Contents

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

config FileLoggerConfig
internalLogCallback Action<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

IReadOnlyCollection<LogLevel>

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

bool

IsEnabled

Gets whether this logger is currently enabled.

public bool IsEnabled { get; }

Property Value

bool

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

entry LogEntry

The log entry to record.

Returns

Task

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

levels HashSet<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

enabled bool

True to enable, false to disable.