Class Logger | Stride API (original) (raw)
Namespace
Assembly
Stride.Core.dll
Base implementation for ILogger.
public abstract class Logger : ILogger
Inheritance
Logger
Implements
Derived
Extension Methods
Constructors
Logger()
Initializes a new instance of the Logger class.
Fields
EnableTypes
protected readonly bool[] EnableTypes
Field Value
bool[]
IsDebugEnabled
True if the debug level is enabled at a global level
public static readonly bool IsDebugEnabled
Field Value
IsVerboseEnabled
True if the verbose level is enabled at a global level
public static readonly bool IsVerboseEnabled
Field Value
Properties
HasErrors
Gets or sets a value indicating whether this instance has errors.
public bool HasErrors { get; set; }
Property Value
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
Module
Gets the module name. read-only.
public string? Module { get; protected set; }
Property Value
The module name.
Methods
ActivateLog(LogMessageType, LogMessageType, bool)
Activates the log for this logger for a range of LogMessageType.
public void ActivateLog(LogMessageType fromLevel, LogMessageType toLevel = LogMessageType.Fatal, bool enabledFlag = true)
Parameters
fromLevel
LogMessageType
The lowest inclusive level to log for.
toLevel
LogMessageType
The highest inclusive level to log for.
enabledFlag
bool
if set to true
this will enable the log, false otherwise. Default is true.
ActivateLog(LogMessageType, bool)
Activates the log for this logger for a specific LogMessageType.
public void ActivateLog(LogMessageType type, bool enabledFlag)
Parameters
type
LogMessageType
The type.
enabledFlag
bool
if set to true
[enabled flag].
Activated(LogMessageType)
Returns a boolean indicating if a particular LogMessageType is activated.
public bool Activated(LogMessageType type)
Parameters
type
LogMessageType
The type.
Returns
True if the log is activated, otherwise false.
Debug(string, CallerInfo?)
Logs the specified debug message.
public void Debug(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The debug message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Debug(string, Exception?, CallerInfo?)
Logs the specified debug message with an exception.
public void Debug(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The debug message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Error(string, CallerInfo?)
Logs the specified error message.
public void Error(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The error message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Error(string, Exception?, CallerInfo?)
Logs the specified error message with an exception.
public void Error(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The error message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Fatal(string, CallerInfo?)
Logs the specified fatal message.
public void Fatal(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The fatal message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Fatal(string, Exception?, CallerInfo?)
Logs the specified fatal message with an exception.
public void Fatal(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The fatal message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Info(string, CallerInfo?)
Logs the specified info message.
public void Info(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The info message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Info(string, Exception?, CallerInfo?)
Logs the specified info message with an exception.
public void Info(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The info message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Log(ILogMessage)
Logs the specified log message.
public void Log(ILogMessage logMessage)
Parameters
logMessage
ILogMessage
The log message.
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
logMessage
ILogMessage
The log message.
Verbose(string, CallerInfo?)
Logs the specified verbose message.
public void Verbose(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The verbose message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Verbose(string, Exception?, CallerInfo?)
Logs the specified verbose message with an exception.
public void Verbose(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The verbose message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Warning(string, CallerInfo?)
Logs the specified warning message.
public void Warning(string message, CallerInfo? callerInfo = null)
Parameters
message
string
The warning message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Warning(string, Exception?, CallerInfo?)
Logs the specified warning message with an exception.
public void Warning(string message, Exception? exception, CallerInfo? callerInfo = null)
Parameters
message
string
The warning message.
exception
Exception
An exception to log with the message.
callerInfo
CallerInfo
Information about the caller. Default is null, otherwise use Get(string, string, int).
Events
MessageLogged
Occurs when a message is logged.
public event EventHandler<MessageLoggedEventArgs>? MessageLogged