Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    Logger Class

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

    Base implementation for ILogger.

    System.Object → Logger
    Derived from Logger: GlobalLogger LoggerResult TimestampLocalLogger

    public abstract class Logger : ILogger
    Name Description
    Constructors
    Logger()

    Initializes a new instance of the Logger class.

    Fields
    EnableTypes
    IsDebugEnabled

    True if the debug level is enabled at a global level

    IsVerboseEnabled

    True if the verbose level is enabled at a global level

    Properties
    HasErrors

    Gets or sets a value indicating whether this instance has errors.

    MinimumLevelEnabled

    Gets the minimum level enabled from the config file. Can be overridden by the user.

    Module

    Gets the module name. read-only.

    Methods
    Activated(LogMessageType)

    Returns a boolean indicating if a particular LogMessageType is activated.

    ActivateLog(LogMessageType, LogMessageType, Boolean)

    Activates the log for this logger for a range of LogMessageType.

    ActivateLog(LogMessageType, Boolean)

    Activates the log for this logger for a specific LogMessageType.

    Debug(String, CallerInfo)

    Logs the specified debug message.

    Debug(String, Exception, CallerInfo)

    Logs the specified debug message with an exception.

    Error(String, CallerInfo)

    Logs the specified error message.

    Error(String, Exception, CallerInfo)

    Logs the specified error message with an exception.

    Fatal(String, CallerInfo)

    Logs the specified fatal message.

    Fatal(String, Exception, CallerInfo)

    Logs the specified fatal message with an exception.

    Info(String, CallerInfo)

    Logs the specified info message.

    Info(String, Exception, CallerInfo)

    Logs the specified info message with an exception.

    Log(ILogMessage)
    LogRaw(ILogMessage)

    Internal method used to log a message. All Info, Debug, Error...etc. methods are calling this method.

    Verbose(String, CallerInfo)

    Logs the specified verbose message.

    Verbose(String, Exception, CallerInfo)

    Logs the specified verbose message with an exception.

    Warning(String, CallerInfo)

    Logs the specified warning message.

    Warning(String, Exception, CallerInfo)

    Logs the specified warning message with an exception.

    Events
    MessageLogged

    Occurs when a message is logged.

    | Improve this Doc View Source

    Constructors


    Logger()

    Initializes a new instance of the Logger class.

    protected Logger()
    | Improve this Doc View Source

    Fields


    EnableTypes

    protected readonly bool[] EnableTypes
    Field Value
    Type Description
    System.Boolean[]

    IsDebugEnabled

    True if the debug level is enabled at a global level

    public static readonly bool IsDebugEnabled
    Field Value
    Type Description
    System.Boolean

    IsVerboseEnabled

    True if the verbose level is enabled at a global level

    public static readonly bool IsVerboseEnabled
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Properties


    HasErrors

    Gets or sets a value indicating whether this instance has errors.

    public bool HasErrors { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has errors; otherwise, false.


    MinimumLevelEnabled

    Gets the minimum level enabled from the config file. Can be overridden by the user.

    public static LogMessageType MinimumLevelEnabled { get; set; }
    Property Value
    Type Description
    LogMessageType

    Module

    Gets the module name. read-only.

    public string Module { get; protected set; }
    Property Value
    Type Description
    System.String

    The module name.

    | Improve this Doc View Source

    Methods


    Activated(LogMessageType)

    Returns a boolean indicating if a particular LogMessageType is activated.

    public bool Activated(LogMessageType type)
    Parameters
    Type Name Description
    LogMessageType type

    The type.

    Returns
    Type Description
    System.Boolean

    True if the log is activated, otherwise false.


    ActivateLog(LogMessageType, LogMessageType, Boolean)

    Activates the log for this logger for a range of LogMessageType.

    public void ActivateLog(LogMessageType fromLevel, LogMessageType toLevel = LogMessageType.Fatal, bool enabledFlag = true)
    Parameters
    Type Name Description
    LogMessageType fromLevel

    The lowest inclusive level to log for.

    LogMessageType toLevel

    The highest inclusive level to log for.

    System.Boolean enabledFlag

    if set to true this will enable the log, false otherwise. Default is true.

    Remarks

    Outside the specified range the log message type are disabled (!enabledFlag).


    ActivateLog(LogMessageType, Boolean)

    Activates the log for this logger for a specific LogMessageType.

    public void ActivateLog(LogMessageType type, bool enabledFlag)
    Parameters
    Type Name Description
    LogMessageType type

    The type.

    System.Boolean enabledFlag

    if set to true [enabled flag].

    Remarks

    All other activated type are leaved intact.


    Debug(String, CallerInfo)

    Logs the specified debug message.

    public void Debug(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The debug message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Debug(String, Exception, CallerInfo)

    Logs the specified debug message with an exception.

    public void Debug(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The debug message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Error(String, CallerInfo)

    Logs the specified error message.

    public void Error(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The error message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Error(String, Exception, CallerInfo)

    Logs the specified error message with an exception.

    public void Error(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The error message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Fatal(String, CallerInfo)

    Logs the specified fatal message.

    public void Fatal(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The fatal message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Fatal(String, Exception, CallerInfo)

    Logs the specified fatal message with an exception.

    public void Fatal(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The fatal message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Info(String, CallerInfo)

    Logs the specified info message.

    public void Info(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The info message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Info(String, Exception, CallerInfo)

    Logs the specified info message with an exception.

    public void Info(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The info message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Log(ILogMessage)

    public void Log(ILogMessage logMessage)
    Parameters
    Type Name Description
    ILogMessage logMessage

    LogRaw(ILogMessage)

    Internal method used to log a message. All Info, Debug, Error...etc. methods are calling this method.

    protected abstract void LogRaw(ILogMessage logMessage)
    Parameters
    Type Name Description
    ILogMessage logMessage

    The log message.


    Verbose(String, CallerInfo)

    Logs the specified verbose message.

    public void Verbose(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The verbose message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Verbose(String, Exception, CallerInfo)

    Logs the specified verbose message with an exception.

    public void Verbose(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The verbose message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Warning(String, CallerInfo)

    Logs the specified warning message.

    public void Warning(string message, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The warning message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).


    Warning(String, Exception, CallerInfo)

    Logs the specified warning message with an exception.

    public void Warning(string message, Exception exception, CallerInfo callerInfo = null)
    Parameters
    Type Name Description
    System.String message

    The warning message.

    System.Exception exception

    An exception to log with the message.

    CallerInfo callerInfo

    Information about the caller. Default is null, otherwise use Get(String, String, Int32).

    | Improve this Doc View Source

    Events


    MessageLogged

    Occurs when a message is logged.

    public event EventHandler<MessageLoggedEventArgs> MessageLogged
    Event Type
    Type Description
    System.EventHandler<MessageLoggedEventArgs>

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    LoggerExtensions.Verbose(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Verbose(ILogger, String, CallerInfo)
    LoggerExtensions.Debug(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Debug(ILogger, String, CallerInfo)
    LoggerExtensions.Info(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Info(ILogger, String, CallerInfo)
    LoggerExtensions.Warning(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Warning(ILogger, String, CallerInfo)
    LoggerExtensions.Error(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Error(ILogger, String, CallerInfo)
    LoggerExtensions.Fatal(ILogger, String, Exception, CallerInfo)
    LoggerExtensions.Fatal(ILogger, String, CallerInfo)
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, Object[])
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, IEnumerable<IReference>, Object[])
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, IReference[], Exception)
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, IEnumerable<IReference>, Exception)
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, Exception, Object[])
    AssetLoggerExtensions.Error(ILogger, Package, IReference, AssetMessageCode, IEnumerable<IReference>, Exception, Object[])
    AssetLoggerExtensions.Warning(ILogger, Package, IReference, AssetMessageCode, IReference[])
    AssetLoggerExtensions.Warning(ILogger, Package, IReference, AssetMessageCode, IEnumerable<IReference>)
    AssetLoggerExtensions.Warning(ILogger, Package, IReference, AssetMessageCode, Object[])
    AssetLoggerExtensions.Warning(ILogger, Package, IReference, AssetMessageCode, IEnumerable<IReference>, Object[])
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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