Try our conversational search powered by Generative AI!

Class LoggerExtensions

NOTE: This is a pre-release API that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version. Provides standard methods for logging messages at different levels.

Inheritance
System.Object
LoggerExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Logging
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public static class LoggerExtensions

Methods

Critical(ILogger, String)

Declaration
public static void Critical(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Critical(ILogger, String, Exception)

Declaration
public static void Critical(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Critical(ILogger, String, Object[])

Declaration
public static void Critical(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Critical<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Critical<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Critical<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Critical<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException

Debug(ILogger, String)

Declaration
public static void Debug(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Debug(ILogger, String, Exception)

Declaration
public static void Debug(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Debug(ILogger, String, Object[])

Declaration
public static void Debug(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Debug<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Debug<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Debug<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Debug<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException

Error(ILogger, String)

Declaration
public static void Error(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Error(ILogger, String, Exception)

Declaration
public static void Error(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Error(ILogger, String, Object[])

Declaration
public static void Error(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Error<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Error<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Error<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Error<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException

Information(ILogger, String)

Declaration
public static void Information(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Information(ILogger, String, Exception)

Declaration
public static void Information(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Information(ILogger, String, Object[])

Declaration
public static void Information(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Information<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Information<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Information<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Information<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException

IsCriticalEnabled(ILogger)

Declaration
public static bool IsCriticalEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger
Returns
Type Description
System.Boolean

IsDebugEnabled(ILogger)

Declaration
public static bool IsDebugEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger
Returns
Type Description
System.Boolean

IsErrorEnabled(ILogger)

Declaration
public static bool IsErrorEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger
Returns
Type Description
System.Boolean

IsInformationEnabled(ILogger)

Declaration
public static bool IsInformationEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger
Returns
Type Description
System.Boolean

IsTraceEnabled(ILogger)

Declaration
public static void IsTraceEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger

IsWarningEnabled(ILogger)

Declaration
public static bool IsWarningEnabled(this ILogger logger)
Parameters
Type Name Description
ILogger logger
Returns
Type Description
System.Boolean

Log(ILogger, Level, String)

Logs the specified message with the provided level.

Declaration
public static void Log(this ILogger logger, Level level, string message)
Parameters
Type Name Description
ILogger logger

The logger.

Level level

The level at which to log the message.

System.String message

The message that should be logged.

Exceptions
Type Condition
System.ArgumentNullException

logger or message

Log(ILogger, Level, String, Exception)

Logs the specified message and exception with the provided level.

Declaration
public static void Log(this ILogger logger, Level level, string message, Exception exception)
Parameters
Type Name Description
ILogger logger

The logger.

Level level

The level at which to log the message.

System.String message

The message that should be logged.

System.Exception exception

The exception that should be logged.

Exceptions
Type Condition
System.ArgumentNullException

logger or message or exception

Log(ILogger, Level, String, Object[])

Logs a message with the provided level using the supplied format and arguments.

Declaration
public static void Log(this ILogger logger, Level level, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger

The logger.

Level level

The level at which to log the message.

System.String messageFormat

The message format string.

System.Object[] args

The arguments.

Exceptions
Type Condition
System.ArgumentNullException

logger or messageFormat

Log<TState>(ILogger, Level, TState, Func<TState, String>)

Declaration
public static void Log<TState>(this ILogger logger, Level level, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
Level level
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Trace(ILogger, String)

Declaration
public static void Trace(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Trace(ILogger, String, Exception)

Declaration
public static void Trace(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Trace(ILogger, String, Object[])

Declaration
public static void Trace(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Trace<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Trace<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Trace<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Trace<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException

Warning(ILogger, String)

Declaration
public static void Warning(this ILogger logger, string message)
Parameters
Type Name Description
ILogger logger
System.String message

Warning(ILogger, String, Exception)

Declaration
public static void Warning(this ILogger logger, string message, Exception exception)
Parameters
Type Name Description
ILogger logger
System.String message
System.Exception exception

Warning(ILogger, String, Object[])

Declaration
public static void Warning(this ILogger logger, string messageFormat, params object[] args)
Parameters
Type Name Description
ILogger logger
System.String messageFormat
System.Object[] args

Warning<TState>(ILogger, TState, Func<TState, String>)

Declaration
public static void Warning<TState>(this ILogger logger, TState state, Func<TState, string> messageFormatter)
Parameters
Type Name Description
ILogger logger
TState state
System.Func<TState, System.String> messageFormatter
Type Parameters
Name Description
TState

Warning<TState, TException>(ILogger, TState, TException, Func<TState, TException, String>)

Declaration
public static void Warning<TState, TException>(this ILogger logger, TState state, TException exception, Func<TState, TException, string> messageFormatter)

    where TException : Exception
Parameters
Type Name Description
ILogger logger
TState state
TException exception
System.Func<TState, TException, System.String> messageFormatter
Type Parameters
Name Description
TState
TException