• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Dapplo.Log
    • AbstractLogger
    • ILogger
    • ILoggerConfiguration
    • LoggerMapper
    • LogInfo
    • LogInfoExtensions
    • LogLevels
    • LogSettings
    • LogSource
    • LogSourceExtensions
    • NullLogger
  • Dapplo.Log.LogFile
    • FileLogger
    • ForwardingLogger
    • IFileLoggerConfiguration
  • Dapplo.Log.Loggers
    • ColorConsoleLogger
    • ConsoleLogger
    • DebugLogger
    • StringWriterLogger
    • TraceLogger
  • Dapplo.Log.XUnit
    • XUnitLogger

Class AbstractLogger

Abstract implementation for ILogger, which safes some time. In general you will only need to implement Write (without exception) as: 1) WriteLine in calls Write after appending a newline. 2) WriteLine with Exception calls WriteLine with the template/parameters and again with the Exception.ToString()

Inheritance
System.Object
AbstractLogger
FileLogger
ForwardingLogger
ColorConsoleLogger
ConsoleLogger
DebugLogger
StringWriterLogger
TraceLogger
NullLogger
XUnitLogger
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Dapplo.Log
Assembly:Dapplo.Log.dll
Syntax
public class AbstractLogger : ILogger, ILoggerConfiguration

Properties

| Improve this Doc View Source

DateTimeFormat

Timestamp format which is used in the output, when outputting the LogInfo details

Declaration
public string DateTimeFormat { get; set; }
Property Value
Type Description
System.String
Implements
ILoggerConfiguration.DateTimeFormat
| Improve this Doc View Source

LogLevel

Use this to specify the LogLevels enum

Declaration
public virtual LogLevels LogLevel { get; set; }
Property Value
Type Description
LogLevels
Implements
ILoggerConfiguration.LogLevel
| Improve this Doc View Source

LogLineFormat

Default line format for loggers which use the DefaultFormatter. The first argument is the LogInfo, the second the message + parameters formatted

Declaration
public string LogLineFormat { get; set; }
Property Value
Type Description
System.String
Implements
ILoggerConfiguration.LogLineFormat
| Improve this Doc View Source

UseShortSource

Defines if the Source is written like d.l.LoggerTest (default) or Dapplo.Log.LoggerTest

Declaration
public bool UseShortSource { get; set; }
Property Value
Type Description
System.Boolean
Implements
ILoggerConfiguration.UseShortSource

Methods

| Improve this Doc View Source

Configure(ILoggerConfiguration)

Configure the logger with the supplied configuration, values are copied.

Declaration
public virtual void Configure(ILoggerConfiguration configuration)
Parameters
Type Name Description
ILoggerConfiguration configuration

ILoggerConfiguration

Implements
ILogger.Configure(ILoggerConfiguration)
| Improve this Doc View Source

Format(LogInfo, String, Object[])

This function can be changed to format the line message differently First argument is the LogInfo, second the messageTemplate, third the parameters

Declaration
public virtual string Format(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type Name Description
LogInfo logInfo
System.String messageTemplate
System.Object[] logParameters
Returns
Type Description
System.String
Implements
ILogger.Format(LogInfo, String, Object[])
| Improve this Doc View Source

IsLogLevelEnabled(LogLevels, LogSource)

Test if a certain LogLevels enum is enabled, optionally the LogSource for which this is requested is supplied and can be used.

Declaration
public virtual bool IsLogLevelEnabled(LogLevels logLevel, LogSource logSource = null)
Parameters
Type Name Description
LogLevels logLevel

LogLevels enum

LogSource logSource

optional LogSource

Returns
Type Description
System.Boolean

true if this is enabled

Implements
ILogger.IsLogLevelEnabled(LogLevels, LogSource)
| Improve this Doc View Source

ReplacedWith(ILogger)

Override this if you need to move your content into a different logger which replaces "you"

Declaration
public virtual void ReplacedWith(ILogger newLogger)
Parameters
Type Name Description
ILogger newLogger

ILogger

Implements
ILogger.ReplacedWith(ILogger)
| Improve this Doc View Source

Write(LogInfo, String, Object[])

Write a message with parameters to the logger

Declaration
public virtual void Write(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type Name Description
LogInfo logInfo

LogInfo

System.String messageTemplate

string with the message template

System.Object[] logParameters

object array with the parameters for the template

Implements
ILogger.Write(LogInfo, String, Object[])
| Improve this Doc View Source

WriteLine(LogInfo, Exception, String, Object[])

WriteLine with Exception calls WriteLine with messageTemplate / logParameters and WriteLine with the exception as string

Declaration
public virtual void WriteLine(LogInfo logInfo, Exception exception, string messageTemplate = null, params object[] logParameters)
Parameters
Type Name Description
LogInfo logInfo

LogInfo

System.Exception exception

Exception

System.String messageTemplate

string with the message template

System.Object[] logParameters

object array with the parameters for the template

Implements
ILogger.WriteLine(LogInfo, Exception, String, Object[])
| Improve this Doc View Source

WriteLine(LogInfo, String, Object[])

WriteLine, default wraps to write, passes a message with parameters to the logger and appends a newline

Declaration
public virtual void WriteLine(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type Name Description
LogInfo logInfo

LogInfo

System.String messageTemplate

string with the message template

System.Object[] logParameters

object array with the parameters for the template

Implements
ILogger.WriteLine(LogInfo, String, Object[])
  • Improve this Doc
  • View Source
Back to top Copyright © 2017 Dapplo