Interface ILogger
Interface that all loggers implement
public interface ILogger
Remarks
This interface supports logging events and testing if a level is enabled for logging.
These methods will not throw exceptions. Note to implementor, ensure that the implementation of these methods cannot allow an exception to be thrown to the caller.
Properties
Name
Gets the name of the logger.
string Name { get; }
Property Value
- string
The name of the logger.
Remarks
The name of this logger
Repository
Gets the ILoggerRepository where this
Logger instance is attached to.
ILoggerRepository Repository { get; }
Property Value
- ILoggerRepository
The ILoggerRepository that this logger belongs to.
Remarks
Gets the ILoggerRepository where this
Logger instance is attached to.
Methods
IsEnabledFor(Level)
Checks if this logger is enabled for a given Level passed as parameter.
bool IsEnabledFor(Level level)
Parameters
levelLevelThe level to check.
Returns
- bool
trueif this logger is enabled forlevel, otherwisefalse.
Remarks
Test if this logger is going to log events of the specified level.
Log(Type, Level, object, Exception)
This generic form is intended to be used by wrappers.
void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)
Parameters
callerStackBoundaryDeclaringTypeTypeThe declaring type of the method that is the stack boundary into the logging system for this call.
levelLevelThe level of the message to be logged.
messageobjectThe message object to log.
exceptionExceptionthe exception to log, including its stack trace. Pass
nullto not log an exception.
Remarks
Generates a logging event for the specified level using
the message and exception.
Log(LoggingEvent)
This is the most generic printing method that is intended to be used by wrappers.
void Log(LoggingEvent logEvent)
Parameters
logEventLoggingEventThe event being logged.
Remarks
Logs the specified logging event through this logger.