Class LogListener
- Namespace
- Stride.Core.Diagnostics
- Assembly
- Stride.Core.dll
A base class to implement a log listener
public abstract class LogListener : IDisposable
- Inheritance
-
LogListener
- Implements
- Derived
- Extension Methods
Constructors
LogListener()
Initializes a new instance of the LogListener class.
protected LogListener()
Properties
LogCountFlushLimit
Gets or sets the log count flush limit. Default is on every message.
public int LogCountFlushLimit { get; set; }
Property Value
- int
The log count flush limit.
LogMessageCount
Gets the log message count.
public int LogMessageCount { get; }
Property Value
- int
The log message count.
TextFormatter
Gets or sets the function that convert a ILogMessage instance into a string.
public Func<ILogMessage, string> TextFormatter { get; set; }
Property Value
UseFlushAsync
Gets or sets a value indicating whether [use flush async].
public bool UseFlushAsync { get; set; }
Property Value
- bool
true
if [use flush async]; otherwise,false
.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public virtual void Dispose()
Flush()
Flush the log, method to be implemented in a subclass.
protected virtual void Flush()
GetDefaultText(ILogMessage)
Gets the default text for a particular log message.
protected virtual string GetDefaultText(ILogMessage logMessage)
Parameters
logMessage
ILogMessageThe log message.
Returns
- string
A textual representation of a message.
GetExceptionText(ILogMessage)
Gets the text that describes the exception associated to a particular log message.
protected virtual string GetExceptionText(ILogMessage message)
Parameters
message
ILogMessageThe log message.
Returns
- string
A textual representation of the exception, or Empty if no exception is associated to this log message.
OnLog(ILogMessage)
Called when a log occurred.
protected abstract void OnLog(ILogMessage logMessage)
Parameters
logMessage
ILogMessageThe log message.
ShouldFlush(ILogMessage)
Returns a boolean indicating whether the log should be flushed. By default, flushing is occurring if the message has a higher level than Info
protected virtual bool ShouldFlush(ILogMessage logMessage)
Parameters
logMessage
ILogMessageThe log message.
Returns
- bool
true
if the log should be flushed,false
otherwise
Operators
implicit operator Action<ILogMessage>(LogListener)
Performs an implicit conversion from LogListener to Action<T>.
public static implicit operator Action<ILogMessage>(LogListener logListener)
Parameters
logListener
LogListenerThe log listener.
Returns
- Action<ILogMessage>
The result of the conversion.