Class TextLoggerProvider
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
loggerILoggerThe destination's logger.
singleLinebooltrue for one line per entry.
includeTimebooltrue to write the time.
includeScopesbooltrue to write the scopes.
includeLevelbooltrue 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
createLoggerFunc<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.
singleLinebooltrue for one line per entry.
includeTimebooltrue to write the time.
includeScopesbooltrue to write the scopes.
includeLevelbooltrue to write the level.
Methods
CreateLogger(string)
Creates a new ILogger instance.
public ILogger CreateLogger(string categoryName)
Parameters
categoryNamestringThe category name for messages produced by the logger.
Returns
Remarks
It keeps one logger per category; under contention the destination's factory may run more than once.
Exceptions
- ArgumentNullException
categoryNameis null.
Dispose()
Forgets the loggers it made; the destination's loggers are not disposed.
public void Dispose()