IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.Logger Class Reference

Temporary logging of errors, warnings and infos for later processing. It is used to log multiple events in order to be processed (reported or otherwise) later. More...

Public Member Functions

void Clear ()
 Removes all logs (if any) currently on the logger. More...
 
void Report (IReporter reporter)
 Reports all logs contained in this logger by the specified reporter. More...
 
void ReportAndClear (IReporter reporter)
 Reports all logs contained in this logger by the specified reporter, then clears the logger (removes all logs from it). More...
 
bool HasLogs ()
 Returns true if logger contains any logs (of any type), false otherwise. More...
 
bool HasLogs (ReportType type)
 Returns true if logger contains any logs of the specified type, false otherwise. More...
 
bool HasErrors ()
 Returns true if logger contains any error logs false otherwise. More...
 
bool HasWarnings ()
 Returns true if logger contains any warning logs false otherwise. More...
 
bool HasInfos ()
 Returns true if logger contains any info logs false otherwise. More...
 
int NumLogs ()
 Returns number of logs (of any type) that logger contains. More...
 
int NumLogs (ReportType type)
 Returns number of logs of the specified type that logger contains. More...
 
int NumErrors ()
 Returns number of error logs that logger contains. More...
 
int NumWarnings ()
 Returns number of warning logs that logger contains. More...
 
int NumInfos ()
 Returns number of info logs that logger contains. More...
 
string GetReport (ReportLevel level, bool printDecorations, bool newLinesAfter)
 Returns a stirng that contains reports for all logs contained in the logger. More...
 
string GetReport (ReportLevel level)
 Returns a stirng that contains reports for all logs contained in the logger. Decorations are printed around reports. A newline is printed after each report. More...
 
string GetReport ()
 Returns a stirng that contains reports for all logs contained in the logger. Reporting level is Info. Decorations are printed around reports. A newline is printed after each report. More...
 
string GetErrorsReport (bool printDecorations, bool newLinesAfter)
 Returns a string that contains reports for all errors contained in the logger. If there are no logs to be reported then an empty string is returned. More...
 
string GetErrorsReport ()
 Returns a string that contains reports for all errors contained in the logger. If there are no logs to be reported then an empty string is returned. More...
 
string GetWarningsReport (bool printDecorations, bool newLinesAfter)
 Returns a string that contains reports for all warnings contained in the logger. If there are no logs to be reported then an empty string is returned. More...
 
string GetWarningsReport ()
 Returns a string that contains reports for all warnings contained in the logger. If there are no logs to be reported then an empty string is returned. More...
 
string GetInfosReport (bool printDecorations, bool newLinesAfter)
 Returns a string that contains reports for all infos contained in the logger. If there are no logs to be reported then an empty string is returned. More...
 
string GetInfosReport ()
 Returns a string that contains reports for all infos contained in the logger. If there are no logs to be reported then an empty string is returned. Decorations are not printed. A newline is printed after each report. More...
 
void Log (ReportType messagetype, string location, string message, Exception ex)
 Adds a new log record initialized according to parameters. More...
 
void Log (ReportType messagetype, string message, Exception ex)
 Adds a new log record initialized according to parameters. More...
 
void Log (ReportType messagetype, Exception ex, string location)
 Adds a new log record initialized according to parameters. More...
 
void Log (ReportType messagetype, Exception ex)
 Adds a new log record initialized according to parameters. More...
 
void Log (ReportType messagetype, string location, string message)
 Adds a new log record initialized according to parameters. More...
 
void Log (ReportType messagetype, string message)
 Adds a new log record initialized according to parameters. More...
 
void LogError (string location, string message, Exception ex)
 Adds a new error log record initialized according to parameters. More...
 
void LogError (string message, Exception ex)
 Adds a new error log record initialized according to parameters. More...
 
void LogError (Exception ex, string location)
 Adds a new error log record initialized according to parameters. More...
 
void LogError (Exception ex)
 Adds a new error log record initialized according to parameters. More...
 
void LogError (string location, string message)
 Adds a new error log record initialized according to parameters. More...
 
void LogError (string message)
 Adds a new error log record initialized according to parameters. More...
 
void LogWarning (string location, string message, Exception ex)
 Adds a new warning log record initialized according to parameters. More...
 
void LogWarning (string message, Exception ex)
 Adds a new warning log record initialized according to parameters. More...
 
void LogWarning (Exception ex, string location)
 Adds a new warning log record initialized according to parameters. More...
 
void LogWarning (Exception ex)
 Adds a new warning log record initialized according to parameters. More...
 
void LogWarning (string location, string message)
 Adds a new warning log record initialized according to parameters. More...
 
void LogWarning (string message)
 Adds a new warning log record initialized according to parameters. More...
 
void LogInfo (string location, string message)
 Adds a new info log record initialized according to parameters. More...
 
void LogInfo (string message)
 Adds a new info log record initialized according to parameters. More...
 

Protected Member Functions

virtual void PrintReport (LogRecord logRecord, StringBuilder sb, bool printDecoration, bool newLineAfter)
 Prints an short report corresponding to the specified log record to the specified StringBuilder. Auxiliary methof used to generate various condensed reports without using a separate reporter. More...
 

Properties

List< LogRecordLogs [get]
 Logs that are currently on logger. More...
 

Private Attributes

List< LogRecord_logs = new List<LogRecord>()
 

Detailed Description

Temporary logging of errors, warnings and infos for later processing. It is used to log multiple events in order to be processed (reported or otherwise) later.

$A Igor Jun10;

Member Function Documentation

void IG.Lib.Logger.Clear ( )
inline

Removes all logs (if any) currently on the logger.

Referenced by IG.Lib.ScriptLoaderBase.ClearLogger().

void IG.Lib.Logger.Report ( IReporter  reporter)
inline

Reports all logs contained in this logger by the specified reporter.

Parameters
reporterReporter used to report logged messages.

References IG.Lib.LogRecord.Ex, IG.Lib.LogRecord.Location, IG.Lib.LogRecord.Message, and IG.Lib.LogRecord.Type.

void IG.Lib.Logger.ReportAndClear ( IReporter  reporter)
inline

Reports all logs contained in this logger by the specified reporter, then clears the logger (removes all logs from it).

Parameters
reporterReporter used to report logged messages.
bool IG.Lib.Logger.HasLogs ( )
inline

Returns true if logger contains any logs (of any type), false otherwise.

bool IG.Lib.Logger.HasLogs ( ReportType  type)
inline

Returns true if logger contains any logs of the specified type, false otherwise.

References IG.Lib.LogRecord.Type.

bool IG.Lib.Logger.HasErrors ( )
inline

Returns true if logger contains any error logs false otherwise.

bool IG.Lib.Logger.HasWarnings ( )
inline

Returns true if logger contains any warning logs false otherwise.

bool IG.Lib.Logger.HasInfos ( )
inline

Returns true if logger contains any info logs false otherwise.

int IG.Lib.Logger.NumLogs ( )
inline

Returns number of logs (of any type) that logger contains.

Returns
int IG.Lib.Logger.NumLogs ( ReportType  type)
inline

Returns number of logs of the specified type that logger contains.

References IG.Lib.LogRecord.Type.

int IG.Lib.Logger.NumErrors ( )
inline

Returns number of error logs that logger contains.

int IG.Lib.Logger.NumWarnings ( )
inline

Returns number of warning logs that logger contains.

int IG.Lib.Logger.NumInfos ( )
inline

Returns number of info logs that logger contains.

virtual void IG.Lib.Logger.PrintReport ( LogRecord  logRecord,
StringBuilder  sb,
bool  printDecoration,
bool  newLineAfter 
)
inlineprotectedvirtual

Prints an short report corresponding to the specified log record to the specified StringBuilder. Auxiliary methof used to generate various condensed reports without using a separate reporter.

Parameters
logRecordLog record whose information is printed.
sbStringBuilder to which information is printed.
printDecorationWhethr a decoration is printed around the report (indicates e.g. type of the reported log record - Error, Warning, Info)
newLineAfterWhether a newline is printed after the report.

References IG.Lib.LogRecord.Ex, IG.Lib.LogRecord.Location, IG.Lib.LogRecord.Message, and IG.Lib.LogRecord.Type.

string IG.Lib.Logger.GetReport ( ReportLevel  level,
bool  printDecorations,
bool  newLinesAfter 
)
inline

Returns a stirng that contains reports for all logs contained in the logger.

Parameters
levelReporting level, logs whose level is greater than prescribed level are not printed.
printDecorationsWhether decorations are printed or not. Decorations outline individual reports and hod information on report types.
newLinesAfterWhether newlines are printed after individual reports.

References IG.Lib.LogRecord.Type.

string IG.Lib.Logger.GetReport ( ReportLevel  level)
inline

Returns a stirng that contains reports for all logs contained in the logger. Decorations are printed around reports. A newline is printed after each report.

Parameters
levelReporting level, logs whose level is greater than prescribed level are not printed.
string IG.Lib.Logger.GetReport ( )
inline

Returns a stirng that contains reports for all logs contained in the logger. Reporting level is Info. Decorations are printed around reports. A newline is printed after each report.

string IG.Lib.Logger.GetErrorsReport ( bool  printDecorations,
bool  newLinesAfter 
)
inline

Returns a string that contains reports for all errors contained in the logger. If there are no logs to be reported then an empty string is returned.

Parameters
printDecorationsWhether decorations are printed or not. Decorations outline individual reports and hod information on report types.
newLinesAfterWhether newlines are printed after individual reports.

References IG.Lib.LogRecord.Type.

Referenced by IG.Lib.ScriptLoaderBase.Compile().

string IG.Lib.Logger.GetErrorsReport ( )
inline

Returns a string that contains reports for all errors contained in the logger. If there are no logs to be reported then an empty string is returned.

string IG.Lib.Logger.GetWarningsReport ( bool  printDecorations,
bool  newLinesAfter 
)
inline

Returns a string that contains reports for all warnings contained in the logger. If there are no logs to be reported then an empty string is returned.

Parameters
printDecorationsWhether decorations are printed or not. Decorations outline individual reports and hod information on report types.
newLinesAfterWhether newlines are printed after individual reports.

References IG.Lib.LogRecord.Type.

string IG.Lib.Logger.GetWarningsReport ( )
inline

Returns a string that contains reports for all warnings contained in the logger. If there are no logs to be reported then an empty string is returned.

string IG.Lib.Logger.GetInfosReport ( bool  printDecorations,
bool  newLinesAfter 
)
inline

Returns a string that contains reports for all infos contained in the logger. If there are no logs to be reported then an empty string is returned.

Parameters
printDecorationsWhether decorations are printed or not. Decorations outline individual reports and hod information on report types.
newLinesAfterWhether newlines are printed after individual reports.

References IG.Lib.LogRecord.Type.

string IG.Lib.Logger.GetInfosReport ( )
inline

Returns a string that contains reports for all infos contained in the logger. If there are no logs to be reported then an empty string is returned. Decorations are not printed. A newline is printed after each report.

void IG.Lib.Logger.Log ( ReportType  messagetype,
string  location,
string  message,
Exception  ex 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.
void IG.Lib.Logger.Log ( ReportType  messagetype,
string  message,
Exception  ex 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.
void IG.Lib.Logger.Log ( ReportType  messagetype,
Exception  ex,
string  location 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
exException that caused creation of log record.
locationDescription of location where logging occurred.
void IG.Lib.Logger.Log ( ReportType  messagetype,
Exception  ex 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
exException that caused creation of log record.
void IG.Lib.Logger.Log ( ReportType  messagetype,
string  location,
string  message 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.Log ( ReportType  messagetype,
string  message 
)
inline

Adds a new log record initialized according to parameters.

Parameters
messagetypeType of the logged record.
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.LogError ( string  location,
string  message,
Exception  ex 
)
inline

Adds a new error log record initialized according to parameters.

Parameters
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.

Referenced by IG.Lib.ScriptLoaderBase.Compile().

void IG.Lib.Logger.LogError ( string  message,
Exception  ex 
)
inline

Adds a new error log record initialized according to parameters.

Parameters
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.
void IG.Lib.Logger.LogError ( Exception  ex,
string  location 
)
inline

Adds a new error log record initialized according to parameters.

Parameters
exException that caused creation of log record.
locationDescription of location where logging occurred.
void IG.Lib.Logger.LogError ( Exception  ex)
inline

Adds a new error log record initialized according to parameters.

Parameters
exException that caused creation of log record.
void IG.Lib.Logger.LogError ( string  location,
string  message 
)
inline

Adds a new error log record initialized according to parameters.

Parameters
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.LogError ( string  message)
inline

Adds a new error log record initialized according to parameters.

Parameters
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.LogWarning ( string  location,
string  message,
Exception  ex 
)
inline

Adds a new warning log record initialized according to parameters.

Parameters
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.

Referenced by IG.Lib.ScriptLoaderBase.AddReferencedAssemblies(), IG.Lib.ScriptLoaderBase.CheckAndCorrectNames(), and IG.Lib.ScriptLoaderBase.Compile().

void IG.Lib.Logger.LogWarning ( string  message,
Exception  ex 
)
inline

Adds a new warning log record initialized according to parameters.

Parameters
messageMessage (or additional explanation) to be logged.
exException that caused creation of log record.
void IG.Lib.Logger.LogWarning ( Exception  ex,
string  location 
)
inline

Adds a new warning log record initialized according to parameters.

Parameters
exException that caused creation of log record.
locationDescription of location where logging occurred.
void IG.Lib.Logger.LogWarning ( Exception  ex)
inline

Adds a new warning log record initialized according to parameters.

Parameters
exException that caused creation of log record.
void IG.Lib.Logger.LogWarning ( string  location,
string  message 
)
inline

Adds a new warning log record initialized according to parameters.

Parameters
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.LogWarning ( string  message)
inline

Adds a new warning log record initialized according to parameters.

Parameters
messageMessage (or additional explanation) to be logged.
void IG.Lib.Logger.LogInfo ( string  location,
string  message 
)
inline

Adds a new info log record initialized according to parameters.

Parameters
locationDescription of location where logging occurred.
messageMessage (or additional explanation) to be logged.

Referenced by IG.Lib.ScriptLoaderBase.Compile().

void IG.Lib.Logger.LogInfo ( string  message)
inline

Adds a new info log record initialized according to parameters.

Parameters
messageMessage (or additional explanation) to be logged.

Member Data Documentation

List<LogRecord> IG.Lib.Logger._logs = new List<LogRecord>()
private

Property Documentation

List<LogRecord> IG.Lib.Logger.Logs
getprotected

Logs that are currently on logger.


The documentation for this class was generated from the following file: