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.
Afficher le fichier Open project: PaulMineau/AIMA.Net

Protected Properties

Свойство Type Description
log Logger
name string
verbosity VerbosityLevel

Méthodes publiques

Méthode 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 méthode

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.
Résultat void

Error() public méthode

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.
Résultat void

Info() public méthode

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.
Résultat void

Logger() public méthode

Default constructor.
public Logger ( ) : System
Résultat System

Logger() public méthode

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).
Résultat System

TestSelf() public static méthode

A simple static self test method.
public static TestSelf ( ) : bool
Résultat bool

Warn() public méthode

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.
Résultat void

Write() public méthode

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

WriteLine() public méthode

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

Property Details

log protected_oe static_oe property

Backer for Log.
protected static Logger log
Résultat Logger

name protected_oe property

The name is prepended to all messages.
protected string name
Résultat string

verbosity protected_oe property

The verbosity of this logger. Messages are filtered based on this setting.
protected VerbosityLevel verbosity
Résultat VerbosityLevel