Skip to content

WrappingPrefixLogger(ILogger, Type) constructor

Defined in

Type: WrappingPrefixLogger Namespace: Splat Assembly: Splat.Logging.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

public WrappingPrefixLogger(ILogger inner, Type callingType)

View source

Summary: Provides an ILogger implementation that prefixes all log messages with the name of a specified type, enabling easier identification of log sources.

Parameters

NameTypeDescription
inner[ILogger](#The underlying ILogger instance to which log messages are forwarded. Cannot be null.
callingTypeTypeThe type whose name is used as a prefix for all log messages. Cannot be null.

Remarks

This logger is useful for scenarios where log output should be clearly associated with a particular class or component. All log messages written through this logger are automatically prefixed with the name of the provided type, followed by a colon and a space. This can help distinguish log entries in applications with multiple components sharing a common logging infrastructure.