Table of Contents

Class LoggingExtensions

Namespace
WindowSill.API
Assembly
WindowSill.API.dll

Provides extension methods for logging.

public static class LoggingExtensions
Inheritance
LoggingExtensions
Inherited Members

Methods

Log(Type)

Creates an instance of ILogger for the specified type.

public static ILogger Log(this Type forType)

Parameters

forType Type

The type to create the logger for.

Returns

ILogger

An instance of ILogger.

Log<T>(T)

Creates an instance of ILogger for the given object's type.

public static ILogger Log<T>(this T instance)

Parameters

instance T

The object instance.

Returns

ILogger

An instance of ILogger.

Type Parameters

T

The type of the object.

MeasureDuration(ILogger, string?)

Measures the duration of an operation and logs the result when the operation completes.

public static DurationLogger MeasureDuration(this ILogger logger, string? measurementName = null)

Parameters

logger ILogger

The ILogger instance used to log the duration.

measurementName string

The name of the operation being measured. Defaults to the caller's member name if not specified.

Returns

DurationLogger

A DurationLogger instance that logs the duration of the operation when disposed.

Remarks

This method is typically used to measure and log the execution time of a code block. The returned DurationLogger should be used within a using statement to ensure proper disposal.