Interface ILogger
This is the interface used for internal logging. The idea is that you can implement a small wrapper for you favorite logger which implements this interface. Assign it to the HttpExtensionsGlobals.Logger and Dapplo.HttpExtensions will start logger with your class. A TraceLogger implementation is supplied, so you can see some output while your project is in development.
Inherited Members
Namespace:Dapplo.Log
Assembly:Dapplo.Log.dll
Syntax
public interface ILogger : ILoggerConfiguration
Methods
| Improve this Doc View SourceConfigure(ILoggerConfiguration)
Configure the logger with the values from the ILoggerConfiguration
Declaration
void Configure(ILoggerConfiguration loggerConfiguration)
Parameters
Type | Name | Description |
---|---|---|
ILoggerConfiguration | loggerConfiguration | ILoggerConfiguration |
Format(LogInfo, String, Object[])
This can be overriden to format the line message differently
Declaration
string Format(LogInfo logInfo, string messageTemplate, object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
LogInfo | logInfo | |
System.String | messageTemplate | |
System.Object[] | parameters |
Returns
Type | Description |
---|---|
System.String |
IsLogLevelEnabled(LogLevels, LogSource)
A simple test, to see if the log level is enabled. Note: level == LogLevels.None should always return false Level == LogLevels.None is actually checked in the extension Optionally the LogSource for which this is requested is supplied and can be used.
Declaration
bool IsLogLevelEnabled(LogLevels logLevel, LogSource logSource = null)
Parameters
Type | Name | Description |
---|---|---|
LogLevels | logLevel | LogLevels |
LogSource | logSource | Optional LogSource |
Returns
Type | Description |
---|---|
System.Boolean | true if enabled |
ReplacedWith(ILogger)
This is called when your logger was the default, and is replaced with a different one. In this method a buffer logger could place all it's content into the new logger.
Declaration
void ReplacedWith(ILogger newLogger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | newLogger | ILogger |
Write(LogInfo, String, Object[])
This writes the LogInfo, messageTemplate and the log parameters to the log
Declaration
void Write(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type | Name | Description |
---|---|---|
LogInfo | logInfo | LogInfo with source, timestamp, level etc |
System.String | messageTemplate | Message (template) with formatting |
System.Object[] | logParameters | Parameters for the template |
WriteLine(LogInfo, Exception, String, Object[])
This writes the LogInfo, exception, messageTemplate and the log parameters to the log, finishing with a newline
Declaration
void WriteLine(LogInfo logInfo, Exception exception, string messageTemplate = null, params object[] logParameters)
Parameters
Type | Name | Description |
---|---|---|
LogInfo | logInfo | LogInfo with source, timestamp, level etc |
System.Exception | exception | exception to log |
System.String | messageTemplate | Message (template) with formatting |
System.Object[] | logParameters | Parameters for the template |
WriteLine(LogInfo, String, Object[])
This writes the LogInfo, messageTemplate and the log parameters to the log, finishing with a newline
Declaration
void WriteLine(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type | Name | Description |
---|---|---|
LogInfo | logInfo | LogInfo with source, timestamp, level etc |
System.String | messageTemplate | Message (template) with formatting |
System.Object[] | logParameters | Parameters for the template |