Class LoggerExtensions
Extension methods for ILogger.
Inheritance
Inherited Members
Namespace: Kephas.Logging
Assembly: Kephas.Core.dll
Syntax
public static class LoggerExtensions
Methods
| Improve this Doc View SourceDebug(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Debug level.
Declaration
public static void Debug(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Debug(ILogger, String, Object[])
Logs a formatted message at Debug level.
Declaration
public static void Debug(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Error(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Error level.
Declaration
public static void Error(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Error(ILogger, String, Object[])
Logs a formatted message at Error level.
Declaration
public static void Error(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Fatal(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Fatal level.
Declaration
public static void Fatal(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Fatal(ILogger, String, Object[])
Logs a formatted message at Fatal level.
Declaration
public static void Fatal(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
GetLogLevel(Exception)
Gets the log level for an exception. This is calculated to be Error if the exception does not implement ISeverityQualifiedException, otherwise the level indicated by the severity level.
Declaration
public static LogLevel GetLogLevel(this Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | The exception. |
Returns
Type | Description |
---|---|
LogLevel | The log level. |
Info(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Info level.
Declaration
public static void Info(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Info(ILogger, String, Object[])
Logs a formatted message at Info level.
Declaration
public static void Info(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
IsDebugEnabled(ILogger)
Indicates whether logging is enabled at the Debug level.
Declaration
public static bool IsDebugEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsErrorEnabled(ILogger)
Indicates whether logging is enabled at the Error level.
Declaration
public static bool IsErrorEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsFatalEnabled(ILogger)
Indicates whether logging is enabled at the Fatal level.
Declaration
public static bool IsFatalEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsInfoEnabled(ILogger)
Indicates whether logging is enabled at the Info level.
Declaration
public static bool IsInfoEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsTraceEnabled(ILogger)
Indicates whether logging is enabled at the Trace level.
Declaration
public static bool IsTraceEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsWarningEnabled(ILogger)
Indicates whether logging is enabled at the Warning level.
Declaration
public static bool IsWarningEnabled(this ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Log(ILogger, LogLevel, String, Object[])
Logs the information at the provided level.
Declaration
public static void Log(this ILogger logger, LogLevel level, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
LogLevel | level | The logging level. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Log(ILogger, Exception)
Logs the exception at the log level indicated be the exception's severity level. This is calculated to be Error if the exception does not implement ISeverityQualifiedException, otherwise the level indicated by the severity level.
Declaration
public static void Log(this ILogger logger, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
Log(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at the log level indicated be the exception's severity level. This is calculated to be Error if the exception does not implement ISeverityQualifiedException, otherwise the level indicated by the severity level.
Declaration
public static void Log(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Merge(ILogger, ILogger[])
Merges the loggers into one aggregate.
Declaration
public static ILogger Merge(this ILogger logger, params ILogger[] loggers)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
ILogger[] | loggers | A variable-length parameters list containing loggers. |
Returns
Type | Description |
---|---|
ILogger | An aggregated logger. |
Trace(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Trace level.
Declaration
public static void Trace(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Trace(ILogger, String, Object[])
Logs a formatted message at Trace level.
Declaration
public static void Trace(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Warn(ILogger, Exception, String, Object[])
Logs the exception with a formatted message at Warning level.
Declaration
public static void Warn(this ILogger logger, Exception exception, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.Exception | exception | The exception. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |
Warn(ILogger, String, Object[])
Logs a formatted message at Warning level.
Declaration
public static void Warn(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger. |
System.String | messageFormat | The message format. |
System.Object[] | args | The arguments. |