Table of Contents

Class TextLoggerProvider

Namespace
VpnHood.Net.Toolkit.Logging
Assembly
VpnHood.Net.Toolkit.dll

Provides a destination's loggers: a TextLogger per category over the destination's logger, so a destination is a plain logger and a line of provider.

public class TextLoggerProvider : ILoggerProvider, IDisposable
Inheritance
TextLoggerProvider
Implements
Derived
Inherited Members
Extension Methods

Constructors

TextLoggerProvider(ILogger, bool, bool, bool, bool)

Initializes a new instance of the TextLoggerProvider class over one logger for every category.

public TextLoggerProvider(ILogger logger, bool singleLine = true, bool includeTime = true, bool includeScopes = true, bool includeLevel = true)

Parameters

logger ILogger

The destination's logger.

singleLine bool

true for one line per entry.

includeTime bool

true to write the time.

includeScopes bool

true to write the scopes.

includeLevel bool

true to write the level.

TextLoggerProvider(Func<string, ILogger>, bool, bool, bool, bool)

Provides a destination's loggers: a TextLogger per category over the destination's logger, so a destination is a plain logger and a line of provider.

public TextLoggerProvider(Func<string, ILogger> createLogger, bool singleLine = true, bool includeTime = true, bool includeScopes = true, bool includeLevel = true)

Parameters

createLogger Func<string, ILogger>

Makes the destination's logger for a category: the same one for every category, or one per category where the destination files by it.

singleLine bool

true for one line per entry.

includeTime bool

true to write the time.

includeScopes bool

true to write the scopes.

includeLevel bool

true to write the level.

Methods

CreateLogger(string)

Creates a new ILogger instance.

public ILogger CreateLogger(string categoryName)

Parameters

categoryName string

The category name for messages produced by the logger.

Returns

ILogger

The instance of ILogger that was created.

Remarks

It keeps one logger per category; under contention the destination's factory may run more than once.

Exceptions

ArgumentNullException

categoryName is null.

Dispose()

Forgets the loggers it made; the destination's loggers are not disposed.

public void Dispose()