Joutsen Logging v0.5.0+22-gec3d058
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
ScopedLogger Class Reference

A logger that creates log records of a specific scope. More...

Public Member Functions

 ScopedLogger (Logger logger, Scope scope, LogRecord endRecord=null)
 Creates a new instance for a specific scope. More...
 
override Guid Log (LogRecord record)
 
override void Dispose ()
 Writes the end record and frees used resources. More...
 
- Public Member Functions inherited from AbstractLogger
abstract void Dispose ()
 
virtual Guid Log (LogRecord record)
 
Guid Log (LogLevel level, string message, params object[] parameters)
 
Guid Log (LogLevel level, string message, object parameter)
 
Guid Log (LogLevel level, string message, Map< string, object > parameters)
 
Guid Log (LogLevel level, string message, IEnumerable listParameter)
 
Guid Error (Exception exception, string message, Map< string, object > parameters)
 
Guid Error (Exception exception, string message, object parameter)
 
Guid Error (Exception exception, string message, params object[] parameters)
 
Guid Error (Exception exception)
 
Guid Error (string message, Map< string, object > parameters)
 
Guid Error (string message, object parameter)
 
Guid Error (string message, params object[] parameters)
 
Guid Error (string message, IEnumerable listParameter)
 
Guid Warning (string message, Map< string, object > parameters)
 
Guid Warning (string message, object parameter)
 
Guid Warning (string message, params object[] parameters)
 
Guid Warning (string message, IEnumerable listParameter)
 
Guid Info (string message, Map< string, object > parameters)
 
Guid Info (string message, object parameter)
 
Guid Info (string message, params object[] parameters)
 
Guid Info (string message, IEnumerable listParameter)
 
Guid Detail (string message, Map< string, object > parameters)
 
Guid Detail (string message, object parameter)
 
Guid Detail (string message, params object[] parameters)
 
Guid Detail (string message, IEnumerable listParameter)
 
Guid Verbose (string message, Map< string, object > parameters)
 
Guid Verbose (string message, object parameter)
 
Guid Verbose (string message, params object[] parameters)
 
Guid Verbose (string message, IEnumerable listParameter)
 

Protected Member Functions

void AddScope (LogRecord record)
 Adds the scope of this logger to a log record unless that record already has a scope. More...
 
- Protected Member Functions inherited from AbstractLogger
virtual bool IsLoggable (LogRecord record)
 Checks if a record is loggabe by this instance of a logger. More...
 

Protected Attributes

Logger logger
 The logger that actually handles the records, usually the one that creates this instance. More...
 
LogRecord endRecord
 the record that will be written when the logger instance is disposed of. More...
 

Properties

virtual Scope Scope [get, protected set]
 The scope used by the logger to create records. More...
 

Additional Inherited Members

- Events inherited from AbstractLogger
Action< LogRecord > Publish
 

Detailed Description

A logger that creates log records of a specific scope.

Since
Unreleased

Constructor & Destructor Documentation

◆ ScopedLogger()

ScopedLogger.ScopedLogger ( Logger  logger,
Scope  scope,
LogRecord  endRecord = null 
)

Creates a new instance for a specific scope.

Parameters
loggera fully configured logger that handles the writing of the records
scopethe scope for the records created by this instance
endRecordan optional record that is created when this instance is disposed of.
Remarks
Using the endRecord can be useful to mark the end of a specific scope if necessary.

Member Function Documentation

◆ AddScope()

void ScopedLogger.AddScope ( LogRecord  record)
protected

Adds the scope of this logger to a log record unless that record already has a scope.

Parameters
recordthe log record to add ascope to

◆ Dispose()

override void ScopedLogger.Dispose ( )
virtual

Writes the end record and frees used resources.

Implements AbstractLogger.

◆ Log()

override Guid ScopedLogger.Log ( LogRecord  record)
virtual

Reimplemented from AbstractLogger.

Member Data Documentation

◆ endRecord

LogRecord ScopedLogger.endRecord
protected

the record that will be written when the logger instance is disposed of.

◆ logger

Logger ScopedLogger.logger
protected

The logger that actually handles the records, usually the one that creates this instance.

Property Documentation

◆ Scope

virtual Scope ScopedLogger.Scope
getprotected set

The scope used by the logger to create records.