Class DiskLogListener

Logs entries using Unity specific outputs.

Inheritance
System.Object DiskLogListener
Implements
ILogListener System.IDisposable
Inherited Members
System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace: BepInEx.Logging
Assembly: BepInEx.Core.dll
Syntax
public class DiskLogListener : ILogListener, IDisposable

Constructors

DiskLogListener(String, LogLevel, Boolean, Boolean, Int32)

Creates a new disk log listener.

Declaration
public DiskLogListener(string localPath, LogLevel displayedLogLevel = LogLevel.Info, bool appendLog = false, bool delayedFlushing = true, int fileLimit = 5)
Parameters
Type Name Description
System.String localPath

Path to the log.

LogLevel displayedLogLevel

Log levels to display.

System.Boolean appendLog

Whether to append logs to an already existing log file.

System.Boolean delayedFlushing

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

System.Int32 fileLimit

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

Fields

BlacklistedSources

Declaration
public static HashSet<string> BlacklistedSources
Field Value
Type Description
System.Collections.Generic.HashSet<System.String>

Properties

DisplayedLogLevel

Log levels to display.

Declaration
public LogLevel DisplayedLogLevel { get; }
Property Value
Type Description
LogLevel

LogLevelFilter

What log levels the listener preliminarily wants.

Declaration
public LogLevel LogLevelFilter { get; }
Property Value
Type Description
LogLevel
Remarks

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 LogEvent(Object, LogEventArgs) whether the messages are going to be processed or discarded.

LogWriter

Writer for the disk log.

Declaration
public TextWriter LogWriter { get; protected set; }
Property Value
Type Description
System.IO.TextWriter

Methods

Dispose()

Declaration
public void Dispose()

Finalize()

Declaration
protected void Finalize()

LogEvent(Object, LogEventArgs)

Handle an incoming log event.

Declaration
public void LogEvent(object sender, LogEventArgs eventArgs)
Parameters
Type Name Description
System.Object sender

Log source that sent the event. Don't use; instead use Source

LogEventArgs eventArgs

Information about the log message.

Implements

ILogListener
System.IDisposable