Show / Hide Table of Contents

Log Method

Log<TState>(LogLevel, EventId, TState, Exception?, Func<TState, Exception?, string>)

Writes an entry to the log.

C#
[Obsolete("Obsolete, use equivalent ILogger method, or view the changelog for further instruction.")]
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)

Parameters

Type Name Description
LogLevel logLevel

The severity or log level for this log entry. See LogLevel for more information.

EventId eventId

An optional event identifier. Use this field if you want the event to be easily consumable by automated tooling. You can use this as a unique identifier for this specific type of event so that your tools can act on them.

TState state

The message or object that you wish to add to the log.

Exception exception

An additional, optional, place to log exceptions that are associated with the log state.

Func<TState, Exception, string> formatter

A function that can take the data specified by the state parameter and transform it into a string representation.

Type Parameters

Name Description
TState

The type of the object being logged. In many cases this will be a string, but some logger implementations support rich object support (called "structured logging").

Implements

ILogger.Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)

Remarks

This method will write an entry to the log that this instance was opened against. The Yubico SDK does not control the concrete implementation of the log. It defers to the logging provider(s) that the application has set up. See LoggerFactory for more information on how to register a concrete logger with the SDK.

In this article
Back to top Generated by DocFX