Class MessageProcessingLogger
- Namespace
- Steeltoe.Extensions.Logging
- Assembly
- Steeltoe.Extensions.Logging.Abstractions.dll
public class MessageProcessingLogger : ILogger
- Inheritance
-
MessageProcessingLogger
- Implements
- Derived
- Inherited Members
Constructors
MessageProcessingLogger(ILogger, IEnumerable<IDynamicMessageProcessor>)
Initializes a new instance of the MessageProcessingLogger class. Wraps an ILogger and decorates log messages via IDynamicMessageProcessor
public MessageProcessingLogger(ILogger iLogger, IEnumerable<IDynamicMessageProcessor> messageProcessors = null)
Parameters
iLogger
ILoggerThe ILogger being wrapped
messageProcessors
IEnumerable<IDynamicMessageProcessor>The list of IDynamicMessageProcessors
Properties
Delegate
public ILogger Delegate { get; }
Property Value
Filter
public Func<string, LogLevel, bool> Filter { get; }
Property Value
Name
public string Name { get; }
Property Value
Methods
BeginScope<TState>(TState)
Begins a logical operation scope.
public IDisposable BeginScope<TState>(TState state)
Parameters
state
TStateThe identifier for the scope.
Returns
- IDisposable
An IDisposable that ends the logical operation scope on dispose.
Type Parameters
TState
The type of the state to begin scope for.
IsEnabled(LogLevel)
Checks if the given logLevel
is enabled.
public bool IsEnabled(LogLevel logLevel)
Parameters
logLevel
LogLevellevel to be checked.
Returns
- bool
true
if enabled.
Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)
Writes a log entry.
public virtual void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
Parameters
logLevel
LogLevelEntry will be written on this level.
eventId
EventIdId of the event.
state
TStateThe entry to be written. Can be also an object.
exception
ExceptionThe exception related to this entry.
formatter
Func<TState, Exception, string>Function to create a string message of the
state
andexception
.
Type Parameters
TState
The type of the object to be written.
WriteMessage(LogLevel, string, int, string, Exception)
public virtual void WriteMessage(LogLevel logLevel, string logName, int eventId, string message, Exception exception)