Class Logger
- Namespace
- Stride.Core.Diagnostics
- 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.
protected Logger()
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
- bool
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
- string
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
LogMessageTypeThe lowest inclusive level to log for.
toLevel
LogMessageTypeThe highest inclusive level to log for.
enabledFlag
boolif 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, bool)
Activates the log for this logger for a specific LogMessageType.
public void ActivateLog(LogMessageType type, bool enabledFlag)
Parameters
type
LogMessageTypeThe type.
enabledFlag
boolif set to
true
[enabled flag].
Remarks
All other activated type are leaved intact.
Activated(LogMessageType)
Returns a boolean indicating if a particular LogMessageType is activated.
public bool Activated(LogMessageType type)
Parameters
type
LogMessageTypeThe type.
Returns
- bool
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
stringThe debug message.
callerInfo
CallerInfoInformation 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
stringThe debug message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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
stringThe error message.
callerInfo
CallerInfoInformation 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
stringThe error message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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
stringThe fatal message.
callerInfo
CallerInfoInformation 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
stringThe fatal message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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
stringThe info message.
callerInfo
CallerInfoInformation 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
stringThe info message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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
ILogMessageThe 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
ILogMessageThe log message.
Verbose(string, CallerInfo)
Logs the specified verbose message.
public void Verbose(string message, CallerInfo callerInfo = null)
Parameters
message
stringThe verbose message.
callerInfo
CallerInfoInformation 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
stringThe verbose message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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
stringThe warning message.
callerInfo
CallerInfoInformation 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
stringThe warning message.
exception
ExceptionAn exception to log with the message.
callerInfo
CallerInfoInformation 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