Class FileLoggerExtension
- Namespace
- Invex.Extensions.Logging.File
- Assembly
- Invex.Extensions.Logging.File.dll
Provides extension methods for registering the file logger with an ILoggingBuilder.
[PublicAPI]
public static class FileLoggerExtension
- Inheritance
-
FileLoggerExtension
- Inherited Members
Methods
AddFile(ILoggingBuilder, Action<FileLoggerConfiguration>, bool)
Adds a file logger provider to the logging pipeline and applies additional configuration via a delegate.
public static ILoggingBuilder AddFile(this ILoggingBuilder builder, Action<FileLoggerConfiguration> configure, bool buffered = true)
Parameters
builderILoggingBuilderThe ILoggingBuilder to add the file logger to.
configureAction<FileLoggerConfiguration>A delegate that configures the FileLoggerConfiguration. Values set here override values bound from the
Logging:Fileconfiguration section.bufferedboolWhen true (the default), log entries are queued and written to disk by a dedicated background thread. When false, each log entry is written to disk synchronously on the calling thread.
Returns
- ILoggingBuilder
The same ILoggingBuilder instance so that additional calls can be chained.
AddFile(ILoggingBuilder, bool)
Adds a file logger provider to the logging pipeline using configuration bound from the
Logging:File configuration section (see FileLoggerConfiguration).
public static ILoggingBuilder AddFile(this ILoggingBuilder builder, bool buffered = true)
Parameters
builderILoggingBuilderThe ILoggingBuilder to add the file logger to.
bufferedboolWhen true (the default), log entries are queued and written to disk by a dedicated background thread, minimizing logging overhead on application threads. When false, each log entry is written to disk synchronously on the calling thread, guaranteeing the entry is persisted before the call returns.
Returns
- ILoggingBuilder
The same ILoggingBuilder instance so that additional calls can be chained.
Remarks
The provider is registered with the alias "File", so it can be configured via the
Logging:File configuration section. Calling this method multiple times registers the
provider only once.