C# Class Skytap.Utilities.Logger

Base class for all loggers. Provides the interface that all loggers must satisfy.
The Logger class and set of Logger subclasses basically implement a Strategy design pattern.
Inheritance: IDisposable
Show file Open project: skytap/Skytap-TFS-Automation-Pack

Public Methods

Method Description
Dispose ( ) : void

Call when logging is complete to clean up any resources (like a file handle).

Flush ( ) : void

Flushes the contents of the log to ensure, in the case of writing to disk, that all content is written appropriately. Not all subclasses override this.

LogError ( string message ) : void

Logs any errors to the log file provided filter levels allow for it.

LogImportant ( string message ) : void

Logs the equivalent of a warning provided filter levels allow for it.

LogInfo ( string message ) : void

Logs informational messages provided filtering allows for it.

Reset ( ) : void

Reset the log file and start over. Not all subclasses will implement this.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Does the real work of Dispose - cleaning up any resources owned by the logger. This class should be overridden in a subclass to provide real functionality.

Logger ( ) : System

Default constructor for Logger. This constructor is protected due to the class being abstract.

_LogError ( string message ) : void

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.

_LogImportant ( string message ) : void

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.

_LogInfo ( string message ) : void

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.

Private Methods

Method Description
GetMessagePrefix ( ) : string

Method Details

Dispose() public method

Call when logging is complete to clean up any resources (like a file handle).
public Dispose ( ) : void
return void

Dispose() protected method

Does the real work of Dispose - cleaning up any resources owned by the logger. This class should be overridden in a subclass to provide real functionality.
protected Dispose ( bool disposing ) : void
disposing bool
return void

Flush() public method

Flushes the contents of the log to ensure, in the case of writing to disk, that all content is written appropriately. Not all subclasses override this.
public Flush ( ) : void
return void

LogError() public method

Logs any errors to the log file provided filter levels allow for it.
public LogError ( string message ) : void
message string Message to input to the log; can be formatted using FormatString /// parameters.
return void

LogImportant() public method

Logs the equivalent of a warning provided filter levels allow for it.
public LogImportant ( string message ) : void
message string Message to input to the log; can be formatted using FormatString /// parameters.
return void

LogInfo() public method

Logs informational messages provided filtering allows for it.
public LogInfo ( string message ) : void
message string Message to input to the log; can be formatted using FormatString /// parameters.
return void

Logger() protected method

Default constructor for Logger. This constructor is protected due to the class being abstract.
protected Logger ( ) : System
return System

Reset() public method

Reset the log file and start over. Not all subclasses will implement this.
public Reset ( ) : void
return void

_LogError() protected abstract method

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.
protected abstract _LogError ( string message ) : void
message string Message to log.
return void

_LogImportant() protected abstract method

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.
protected abstract _LogImportant ( string message ) : void
message string Message to log.
return void

_LogInfo() protected abstract method

Implemented by subclass. Called by this base class to have a subclass do the real work of the logging. This technique follows the strategy pattern.
protected abstract _LogInfo ( string message ) : void
message string Message to log.
return void