Joutsen Logging v0.5.0+26-g72240ac
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
Joutsen.Logging.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.
 
override Guid Log (LogRecord record)
 Logs a record.
 
override void Dispose ()
 Writes the end record and frees used resources.
 
- Public Member Functions inherited from Joutsen.Logging.AbstractLogger
void Dispose ()
 
Guid Log (LogLevel level, string message, params object[] parameters)
 Logs a message of a specific log level.
 
Guid Log (LogLevel level, string message, object parameter)
 Logs a message of a specific log level.
 
Guid Log (LogLevel level, string message, Map< string, object > parameters)
 Logs a message of a specific log level.
 
Guid Log (LogLevel level, string message, IEnumerable listParameter)
 Logs a message of a specific log level with a list as parameter.
 
Guid Error (Exception exception, string message, Map< string, object > parameters)
 Logs an exception with an additional message.
 
Guid Error (Exception exception, string message, object parameter)
 Logs an exception with an additional message.
 
Guid Error (Exception exception, string message, params object[] parameters)
 Logs an exception with an additional message.
 
Guid Error (Exception exception)
 Logs an System.Exception as an error.
 
Guid Error (string message, Map< string, object > parameters)
 Logs an error message with parameters.
 
Guid Error (string message, object parameter)
 Logs an error message with parameters.
 
Guid Error (string message, params object[] parameters)
 Logs an error message with parameters.
 
Guid Error (string message, IEnumerable listParameter)
 Logs an error message with a list.
 
Guid Warning (string message, Map< string, object > parameters)
 Logs a warning message with parameters.
 
Guid Warning (string message, object parameter)
 Logs a warning message with parameters.
 
Guid Warning (string message, params object[] parameters)
 Logs a warning message with parameters.
 
Guid Warning (string message, IEnumerable listParameter)
 Logs an warning message with a list.
 
Guid Info (string message, Map< string, object > parameters)
 Logs an informational message with parameters.
 
Guid Info (string message, object parameter)
 Logs an informational message with parameters.
 
Guid Info (string message, params object[] parameters)
 Logs an informational message with parameters.
 
Guid Info (string message, IEnumerable listParameter)
 Logs an informational message with a list.
 
Guid Detail (string message, Map< string, object > parameters)
 Logs a detail message with parameters.
 
Guid Detail (string message, object parameter)
 Logs a detail message with parameters.
 
Guid Detail (string message, params object[] parameters)
 Logs a detail message with parameters.
 
Guid Detail (string message, IEnumerable listParameter)
 Logs a detail message with a list.
 
Guid Verbose (string message, Map< string, object > parameters)
 Logs a verbose message with parameters.
 
Guid Verbose (string message, object parameter)
 Logs a verbose message with parameters.
 
Guid Verbose (string message, params object[] parameters)
 Logs a verbose message with parameters.
 
Guid Verbose (string message, IEnumerable listParameter)
 Logs a verbose message with a list.
 

Protected Member Functions

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

Protected Attributes

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

Properties

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

Additional Inherited Members

- Events inherited from Joutsen.Logging.AbstractLogger
Action< LogRecord > Publish
 

Detailed Description

A logger that creates log records of a specific scope.

Since
Unreleased

Constructor & Destructor Documentation

◆ ScopedLogger()

Joutsen.Logging.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 Joutsen.Logging.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 Joutsen.Logging.ScopedLogger.Dispose ( )

Writes the end record and frees used resources.

◆ Log()

override Guid Joutsen.Logging.ScopedLogger.Log ( LogRecord  record)
virtual

Logs a record.

Parameters
recordthe record to be logged
Returns
the id of the logged record or an empty System.Guid if the record was filtered out

Reimplemented from Joutsen.Logging.AbstractLogger.

Member Data Documentation

◆ endRecord

LogRecord Joutsen.Logging.ScopedLogger.endRecord
protected

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

◆ logger

Logger Joutsen.Logging.ScopedLogger.logger
protected

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

Property Documentation

◆ Scope

virtual Scope Joutsen.Logging.ScopedLogger.Scope
getprotected set

The scope used by the logger to create records.