C# Класс 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.
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
log Logger
name string
verbosity VerbosityLevel

Открытые методы

Метод Описание
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.

Описание методов

Debug() публичный Метод

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.
Результат void

Error() публичный Метод

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.
Результат void

Info() публичный Метод

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.
Результат void

Logger() публичный Метод

Default constructor.
public Logger ( ) : System
Результат System

Logger() публичный Метод

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).
Результат System

TestSelf() публичный статический Метод

A simple static self test method.
public static TestSelf ( ) : bool
Результат bool

Warn() публичный Метод

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.
Результат void

Write() публичный Метод

Write a string with no verbosity checking and no formatting.
public Write ( string msg ) : void
msg string The format string.
Результат void

WriteLine() публичный Метод

Write a line with no verbosity checking and no formatting.
public WriteLine ( string msg ) : void
msg string The format string.
Результат void

Описание свойств

log защищенное статическое свойство

Backer for Log.
protected static Logger log
Результат Logger

name защищенное свойство

The name is prepended to all messages.
protected string name
Результат string

verbosity защищенное свойство

The verbosity of this logger. Messages are filtered based on this setting.
protected VerbosityLevel verbosity
Результат VerbosityLevel