Skip to content

DiskLogListener Class

Logs entries using Unity specific outputs.

C#
public class DiskLogListener : ILogListener, IDisposable

Inheritance object

Implements ILogListener, IDisposable

DiskLogListener(string, LogLevel, bool, bool, int)

Section titled “DiskLogListener(string, LogLevel, bool, bool, int)”

Creates a new disk log listener.

C#
public DiskLogListener(string localPath, LogLevel displayedLogLevel = LogLevel.Info, bool appendLog = false, bool delayedFlushing = true, int fileLimit = 5)

localPath string
Path to the log.

displayedLogLevel LogLevel
Log levels to display.

appendLog bool
Whether to append logs to an already existing log file.

delayedFlushing bool
Whether to delay flushing to disk to improve performance. Useful to set this to false when debugging crashes.

fileLimit int
Maximum amount of concurrently opened log files. Can help with infinite game boot loops.

C#
public static HashSet<string> BlacklistedSources

Log levels to display.

C#
public LogLevel DisplayedLogLevel { get; }

Writer for the disk log.

C#
public TextWriter LogWriter { get; protected set; }

What log levels the listener preliminarily wants.

C#
public LogLevel LogLevelFilter { get; }

The filter is used to more efficiently discard log messages that aren’t being listened to. As such, the filter should represent the log levels that the listener will always want to process. It is up to the the implementation of BepInEx.Logging.ILogListener.LogEvent(System.Object%2cBepInEx.Logging.LogEventArgs) whether the messages are going to be processed or discarded.

Handle an incoming log event.

C#
public void LogEvent(object sender, LogEventArgs eventArgs)

sender object
Log source that sent the event. Don’t use; instead use

eventArgs LogEventArgs
Information about the log message.

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

C#
public void Dispose()
C#
protected ~DiskLogListener()