FileLogger
Simple file logger that appends log entries to a file.
public sealed class FileLogger : ILogger
Constructors
FileLogger
public FileLogger(string path, string category, object lockObj)
Initializes a new instance of FileLogger.
| Parameter | Type | Description |
|---|---|---|
path |
String |
|
category |
String |
|
lockObj |
Object |
Methods
BeginScope<TState>(TState)
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
Begins a logical operation scope.
Parameters:
| Name | Type | Description |
|---|---|---|
state |
<TState> |
Returns: IDisposable
IsEnabled(LogLevel)
public bool IsEnabled(LogLevel logLevel)
Checks if the given log level is enabled.
Parameters:
| Name | Type | Description |
|---|---|---|
logLevel |
LogLevel |
Returns: Boolean
Log<TState>(LogLevel, EventId, TState, Exception?, Func<TState, Exception?, string>)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
Writes a log entry to the file.
Parameters:
| Name | Type | Description |
|---|---|---|
logLevel |
LogLevel |
|
eventId |
EventId |
|
state |
<TState> |
|
exception |
Exception |
|
formatter |
String> |