Click or drag to resize

ILogManager Interface

Describes an application log manager implementation. LogManager is a reasonable implementation for many situations but it's possible for developers to implement custom solutions.

Namespace:  Neon.Diagnostics
Assembly:  Neon.Common (in Neon.Common.dll) Version: 2.10.0
public interface ILogManager : ILoggerProvider, 

The ILogManager type exposes the following members.

Public propertyEmitIndex
Controls whether the index field is emitted. This is a counter start starts at zero for each application instance and is incremented for each event emitted to help reconstruct exactly what happened when the system time resolution isn't fine enough. This defaults to true.
Public propertyEmitTimestamp
Controls whether timestamps are emitted. This defaults to true.
Public propertyLoggerCreator
Public propertyLogLevel
Specifies the level required for events to be actually recorded.
Public propertyVersion
The version of the current program or null if not known. This should be formatted as a valid SemanticVersion when not null.
Public methodCreateLogger
Creates a new ILogger instance.
(Inherited from ILoggerProvider.)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodGetLogger(String, String, FuncBoolean)
Returns a named logger.
Public methodGetLogger(Type, String, FuncBoolean)
Returns a logger to be associated with a specific type. This method supports both static and normal types.
Public methodGetLoggerT(String, FuncBoolean)
Returns a logger to be associated with a specific type. This method works only for non-static types.
Public methodGetNextEventIndex
Returns the next event index.
Public methodReset
Intended to reset the log manager to its default condition. Implementations may cxustomize what this actually does but the default LogManager implementation resets its emitted event counter to zewro, clears and cached loggers, and resets the LoggerCreator delegate.
Public methodSetLogLevel
Sets the log level by safely parsing a string.

Neon log managers are used to manage one or more INeonLogger instances that handle logging for parts of your application, we refer to as modules. By convention, a module is often the fully qualified name of the .NET type doing the logging but this is just a string and can be set to anything. Log managers are responsible for mapping modules to loggers, potentially caching these loggers for performance, and then submitting events to these loggers to be recorded.

Log managers also maintain a long count of the events emitted by the application. This counter is used to record the index of the event in the stream of application events. This index is typically one-based and is useful for knowing the strict order that events were actually recorded. Event timestamps often don't have enough resolution accomplish this.

Log managers provide the LogLevel property which can be used to control which events are actually recorded. LogLevel for information about the relative lof levels.

Log managers typically provide a default INeonLogger implementation. LogManager defaults to logging events to STDERR as text via TextLogger which is suitable for many server applications, espectially for those deployed as containers where this is standard behavior. LogManager also implements the LoggerCreator delegate as an easy way to support custom loggers in your application without having to implement a custom ILogManager as well.

See Also