## Class TLogger

Description

TLogger class.

TLogger records log messages in memory and implements the methods to retrieve the messages with filter conditions, including log levels and log categories.

- since: 3.0
- version: $Id: TLogger.php 2541 2008-10-21 15:05:13Z qiang.xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Util/TLogger.php (line 25)

    TComponent
       |
       --TLogger

Class Constant Summary
ALERT = 0x20
DEBUG = 0x01
ERROR = 0x10
FATAL = 0x40
INFO = 0x02
NOTICE = 0x04
WARNING = 0x08
Method Summary
void getLogs ([integer $levels = null], [string $categories = null], array 2)
void log (string $message, integer $level, [string $category = 'Uncategorized'])
Methods
getLogs (line 86)

Retrieves log messages.

Messages may be filtered by log levels and/or categories. A level filter is specified by an integer, whose bits indicate the levels interested. For example, (TLogger::INFO | TLogger::WARNING) specifies INFO and WARNING levels. A category filter is specified by concatenating interested category names with commas. A message whose category name starts with any filtering category will be returned. For example, a category filter 'System.Web, System.IO' will return messages under categories such as 'System.Web', 'System.IO', 'System.Web.UI', 'System.Web.UI.WebControls', etc. Level filter and category filter are combinational, i.e., only messages satisfying both filter conditions will they be returned.

- access: public

void getLogs ([integer $levels = null], [string $categories = null], array 2)

- array 2: list of messages. Each array elements represents one message with the following structure: array( [0] => message [1] => level [2] => category [3] => timestamp (by microtime(), float number));
- integer $levels: level filter
- string $categories: category filter

log (line 59)

Logs a message.

Messages logged by this method may be retrieved via getLogs.

- access: public

void log (string $message, integer $level, [string $category = 'Uncategorized'])

- string $message: message to be logged
- integer $level: level of the message. Valid values include TLogger::DEBUG, TLogger::INFO, TLogger::NOTICE, TLogger::WARNING, TLogger::ERROR, TLogger::ALERT, TLogger::FATAL.
- string $category: category of the message

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants
ALERT = 0x20 (line 35)
DEBUG = 0x01 (line 30)

Log levels.

ERROR = 0x10 (line 34)
FATAL = 0x40 (line 36)
INFO = 0x02 (line 31)
NOTICE = 0x04 (line 32)
WARNING = 0x08 (line 33)

Documentation generated on Mon, 22 Feb 2010 12:18:08 +0000 by phpDocumentor 1.3.0RC4