C# Class RTools.Util.Logger

This is a simple implementation of a Logger class. The purpose is to threshold output based on a verbosity setting, format messages similarly, and collect all message writes such that they can be redirected easily. You (and I) should probably use the Apache Software Foundation's log4net instead of this class.
This doesn't implement much of the functionality possible with this interface. This could redirect messages to other text writers, forward messages to subscribers, etc.
Mostrar archivo Open project: PaulMineau/AIMA.Net

Protected Properties

Property Type Description
log Logger
name string
verbosity VerbosityLevel

Public Methods

Method Description
Debug ( string msg ) : void

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.

Error ( string msg ) : void

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.

Info ( string msg ) : void

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.

Logger ( ) : System

Default constructor.

Logger ( string name ) : System

Construct and set name.

TestSelf ( ) : bool

A simple static self test method.

Warn ( string msg ) : void

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.

Write ( string msg ) : void

Write a string with no verbosity checking and no formatting.

WriteLine ( string msg ) : void

Write a line with no verbosity checking and no formatting.

Method Details

Debug() public method

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.
public Debug ( string msg ) : void
msg string The format string.
return void

Error() public method

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.
public Error ( string msg ) : void
msg string The format string.
return void

Info() public method

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.
public Info ( string msg ) : void
msg string The format string.
return void

Logger() public method

Default constructor.
public Logger ( ) : System
return System

Logger() public method

Construct and set name.
public Logger ( string name ) : System
name string The name for this logger. This name /// is prepended to output messages (except Out messages).
return System

TestSelf() public static method

A simple static self test method.
public static TestSelf ( ) : bool
return bool

Warn() public method

Write a string of this particular verbosity. This will not output the string unless the verbosity is greater than or equal to this object's threshold. This prepends the level of the message and the name of this Logger.
public Warn ( string msg ) : void
msg string The format string.
return void

Write() public method

Write a string with no verbosity checking and no formatting.
public Write ( string msg ) : void
msg string The format string.
return void

WriteLine() public method

Write a line with no verbosity checking and no formatting.
public WriteLine ( string msg ) : void
msg string The format string.
return void

Property Details

log protected_oe static_oe property

Backer for Log.
protected static Logger log
return Logger

name protected_oe property

The name is prepended to all messages.
protected string name
return string

verbosity protected_oe property

The verbosity of this logger. Messages are filtered based on this setting.
protected VerbosityLevel verbosity
return VerbosityLevel