LogListener Class
Namespace: Stride.Core.DiagnosticsAssembly: Stride.Core.dll
A base class to implement a log listener
public abstract class LogListener : IDisposable
Name | Description | |
---|---|---|
Constructors | ||
LogListener() | Initializes a new instance of the LogListener class. |
|
Properties | ||
LogCountFlushLimit | Gets or sets the log count flush limit. Default is on every message. |
|
LogMessageCount | Gets the log message count. |
|
TextFormatter | Gets or sets the function that convert a ILogMessage instance into a string. |
|
UseFlushAsync | Gets or sets a value indicating whether [use flush async]. |
|
Methods | ||
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
|
Flush() | Flush the log, method to be implemented in a subclass. |
|
GetDefaultText(ILogMessage) | Gets the default text for a particular log message. |
|
GetExceptionText(ILogMessage) | Gets the text that describes the exception associated to a particular log message. |
|
OnLog(ILogMessage) | Called when a log occurred. |
|
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 |
|
Operators | ||
Implicit(LogListener to Action<ILogMessage>) | Performs an implicit conversion from LogListener to System.Action<T>. |
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
Type | Description |
---|---|
System.Int32 | The log count flush limit. |
LogMessageCount
Gets the log message count.
public int LogMessageCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | 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
Type | Description |
---|---|
System.Func<ILogMessage, System.String> |
UseFlushAsync
Gets or sets a value indicating whether [use flush async].
public bool UseFlushAsync { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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
Type | Name | Description |
---|---|---|
ILogMessage | logMessage | The log message. |
Returns
Type | Description |
---|---|
System.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
Type | Name | Description |
---|---|---|
ILogMessage | message | The log message. |
Returns
Type | Description |
---|---|
System.String | A textual representation of the exception, or System.String.Empty if no exception is associated to this log message. |
OnLog(ILogMessage)
Called when a log occurred.
protected abstract void OnLog(ILogMessage logMessage)
Parameters
Type | Name | Description |
---|---|---|
ILogMessage | logMessage | The 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
Type | Name | Description |
---|---|---|
ILogMessage | logMessage | The log message. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Operators
Implicit(LogListener to Action<ILogMessage>)
Performs an implicit conversion from LogListener to System.Action<T>.
public static implicit operator Action<ILogMessage>(LogListener logListener)
Parameters
Type | Name | Description |
---|---|---|
LogListener | logListener | The log listener. |
Returns
Type | Description |
---|---|
System.Action<ILogMessage> | The result of the conversion. |