Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    LogListener Class

    Namespace: Stride.Core.Diagnostics
    Assembly: Stride.Core.dll

    A base class to implement a log listener

    System.Object → LogListener
    Derived from LogListener: ConsoleLogListener DebugLogListener TextWriterLogListener

    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>.

    | Improve this Doc View Source

    Constructors


    LogListener()

    Initializes a new instance of the LogListener class.

    protected LogListener()
    | Improve this Doc View Source

    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

    true if [use flush async]; otherwise, false.

    | Improve this Doc View Source

    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

    true if the log should be flushed, false otherwise

    | Improve this Doc View Source

    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.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation