Table of Contents

Class ILoggerExtensions

Namespace
Switchboard
Assembly
Switchboard.ILogger.dll

Provides extension methods for the ILogger interface that assign the LogLevel based on the method.

public static class ILoggerExtensions
Inheritance
ILoggerExtensions

Methods

Log(ILogger, LogLevel, Exception)

Logs an exception.

public static void Log(this ILogger logger, LogLevel logLevel, Exception exception)

Parameters

logger ILogger

The logger.

logLevel LogLevel

The level of significance assigned to the exception.

exception Exception

The exception to log.

LogCritical(ILogger, Exception)

Logs an exception with the LogLevel set to Critical.

public static void LogCritical(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogCritical(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Critical.

public static void LogCritical(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogCritical(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Critical.

public static void LogCritical(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

LogDebug(ILogger, Exception)

Logs an exception with the LogLevel set to Debug.

public static void LogDebug(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogDebug(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Debug.

public static void LogDebug(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogDebug(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Debug.

public static void LogDebug(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

LogError(ILogger, Exception)

Logs an exception with the LogLevel set to Error.

public static void LogError(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogError(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Error.

public static void LogError(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogError(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Error.

public static void LogError(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

LogInformation(ILogger, Exception)

Logs an exception with the LogLevel set to Information.

public static void LogInformation(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogInformation(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Information.

public static void LogInformation(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogInformation(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Information.

public static void LogInformation(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

LogTrace(ILogger, Exception)

Logs an exception with the LogLevel set to Trace.

public static void LogTrace(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogTrace(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Trace.

public static void LogTrace(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogTrace(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Trace.

public static void LogTrace(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

LogWarning(ILogger, Exception)

Logs an exception with the LogLevel set to Warning.

public static void LogWarning(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

LogWarning(ILogger, Exception, ReadOnlySpan<char>)

Logs an exception with the LogLevel set to Warning.

public static void LogWarning(this ILogger logger, Exception exception, ReadOnlySpan<char> message)

Parameters

logger ILogger

The logger.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

LogWarning(ILogger, ReadOnlySpan<char>, string, string, int)

Logs a message with the LogLevel set to Warning.

public static void LogWarning(this ILogger logger, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logger ILogger

The logger.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.