Table of Contents

Class LoggerExtensions

Namespace
Yubico.Core.Logging
Assembly
Yubico.Core.dll

Logger extension methods for common scenarios.

public static class LoggerExtensions
Inheritance
object
LoggerExtensions

Methods

SensitiveLog(ILogger, LogLevel, EventId, Exception, string, params object?[])

Formats and writes a log message that may contain sensitive information at the specified log level.

public static void SensitiveLog(this ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

logLevel LogLevel

Entry will be written on this level.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message.

args object[]

An object array that contains zero or more objects to format.

SensitiveLog(ILogger, LogLevel, Exception, string, params object?[])

Formats and writes a log message that may contain sensitive information at the specified log level.

public static void SensitiveLog(this ILogger logger, LogLevel logLevel, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

logLevel LogLevel

Entry will be written on this level.

exception Exception

The exception to log.

message string

Format string of the log message.

args object[]

An object array that contains zero or more objects to format.

SensitiveLog(ILogger, LogLevel, string, params object?[])

Formats and writes a log message that may contain sensitive information at the specified log level.

public static void SensitiveLog(this ILogger logger, LogLevel logLevel, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

logLevel LogLevel

Entry will be written on this level.

message string

Format string of the log message.

args object[]

An object array that contains zero or more objects to format.

SensitiveLogCritical(ILogger, EventId, Exception, string, params object?[])

Formats and writes a critical log message that contains potentially sensitive information.

public static void SensitiveLogCritical(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogCritical(0, exception, "Error while processing request from {Address}", address)

SensitiveLogCritical(ILogger, EventId, string, params object?[])

Formats and writes a critical log message that contains potentially sensitive information.

public static void SensitiveLogCritical(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogCritical(0, "Processing request from {Address}", address)

SensitiveLogCritical(ILogger, Exception, string, params object?[])

Formats and writes a critical log message that contain potentially sensitive information.

public static void SensitiveLogCritical(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogCritical(exception, "Error while processing request from {Address}", address)

SensitiveLogCritical(ILogger, string, params object?[])

Formats and writes a critical log message that contains potentially sensitive information.

public static void SensitiveLogCritical(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogCritical("Processing request from {Address}", address)

SensitiveLogDebug(ILogger, EventId, Exception, string, params object?[])

Formats and writes a debug log message that contains potentially sensitive information.

public static void SensitiveLogDebug(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogDebug(0, exception, "Error while processing request from {Address}", address)

SensitiveLogDebug(ILogger, EventId, string, params object?[])

Formats and writes a debug log message that contains potentially sensitive information.

public static void SensitiveLogDebug(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogDebug(0, "Processing request from {Address}", address)

SensitiveLogDebug(ILogger, Exception, string, params object?[])

Formats and writes a debug log message that contains potentially sensitive information.

public static void SensitiveLogDebug(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogDebug(exception, "Error while processing request from {Address}", address)

SensitiveLogDebug(ILogger, string, params object?[])

Formats and writes a debug log message that contains potentially sensitive information.

public static void SensitiveLogDebug(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogDebug("Processing request from {Address}", address)

SensitiveLogError(ILogger, EventId, Exception, string, params object?[])

Formats and writes an error log message that contains potentially sensitive information.

public static void SensitiveLogError(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogError(0, exception, "Error while processing request from {Address}", address)

SensitiveLogError(ILogger, EventId, string, params object?[])

Formats and writes an error log message that contains potentially sensitive information.

public static void SensitiveLogError(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogError(0, "Processing request from {Address}", address)

SensitiveLogError(ILogger, Exception, string, params object?[])

Formats and writes an error log message that contains potentially sensitive information.

public static void SensitiveLogError(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogError(exception, "Error while processing request from {Address}", address)

SensitiveLogError(ILogger, string, params object?[])

Formats and writes an error log message that contains potentially sensitive information.

public static void SensitiveLogError(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogError("Processing request from {Address}", address)

SensitiveLogInformation(ILogger, EventId, Exception, string, params object?[])

Formats and writes an informational log message that contains potentially sensitive information.

public static void SensitiveLogInformation(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogInformation(0, exception, "Error while processing request from {Address}", address)

SensitiveLogInformation(ILogger, EventId, string, params object?[])

Formats and writes an informational log message that contains potentially sensitive information.

public static void SensitiveLogInformation(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogInformation(0, "Processing request from {Address}", address)

SensitiveLogInformation(ILogger, Exception, string, params object?[])

Formats and writes an informational log message that contains potentially sensitive information.

public static void SensitiveLogInformation(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogInformation(exception, "Error while processing request from {Address}", address)

SensitiveLogInformation(ILogger, string, params object?[])

Formats and writes an informational log message that contains potentially sensitive information.

public static void SensitiveLogInformation(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogInformation("Processing request from {Address}", address)

SensitiveLogTrace(ILogger, EventId, Exception, string, params object?[])

Formats and writes a trace log message that contains potentially sensitive information.

public static void SensitiveLogTrace(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogTrace(0, exception, "Error while processing request from {Address}", address)

SensitiveLogTrace(ILogger, EventId, string, params object?[])

Formats and writes a trace log message that contains potentially sensitive information.

public static void SensitiveLogTrace(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogTrace(0, "Processing request from {Address}", address)

SensitiveLogTrace(ILogger, Exception, string, params object?[])

Formats and writes a trace log message that contains potentially sensitive information.

public static void SensitiveLogTrace(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogTrace(exception, "Error while processing request from {Address}", address)

SensitiveLogTrace(ILogger, string, params object?[])

Formats and writes a trace log message that contains potentially sensitive information.

public static void SensitiveLogTrace(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogTrace("Processing request from {Address}", address)

SensitiveLogWarning(ILogger, EventId, Exception, string, params object?[])

Formats and writes a warning log message that contains potentially sensitive information.

public static void SensitiveLogWarning(this ILogger logger, EventId eventId, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogWarning(0, exception, "Error while processing request from {Address}", address)

SensitiveLogWarning(ILogger, EventId, string, params object?[])

Formats and writes a warning log message that contains potentially sensitive information.

public static void SensitiveLogWarning(this ILogger logger, EventId eventId, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

eventId EventId

The event id associated with the log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogWarning(0, "Processing request from {Address}", address)

SensitiveLogWarning(ILogger, Exception, string, params object?[])

Formats and writes a warning log message that contains potentially sensitive information.

public static void SensitiveLogWarning(this ILogger logger, Exception exception, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

exception Exception

The exception to log.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogWarning(exception, "Error while processing request from {Address}", address)

SensitiveLogWarning(ILogger, string, params object?[])

Formats and writes a warning log message that contains potentially sensitive information.

public static void SensitiveLogWarning(this ILogger logger, string message, params object?[] args)

Parameters

logger ILogger

The Yubico.Core.Logging.Logger to write to.

message string

Format string of the log message in message template format. Example: "User {User} logged in from {Address}"

args object[]

An object array that contains zero or more objects to format.

Examples

logger.LogWarning("Processing request from {Address}", address)