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, log categories, and by control.

  • author: Qiang Xue <qiang.xue@gmail.com>
  • version: $Id: TLogger.php 3085 2011-12-21 16:03:29Z ctrlaltca@gmail.com $
  • since: 3.0

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 deleteLogs ([integer $levels = null], [array $categories = null], [array $controls = null], [ $timestamp = null])
array getLogs ([integer $levels = null], [array $categories = null], [array $controls = null], [ $timestamp = null])
void log (string $message, integer $level, [string $category = 'Uncategorized'], [string|TControl $ctl = null])
Methods
deleteLogs (line 157)

Deletes log messages from the queue.

Messages may be filtered by log levels and/or categories and/or control client ids and/or timestamp. 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 an array of categories to filter. A message whose category name starts with any filtering category will be deleted. For example, a category filter array('System.Web','System.IO') will delete messages under categories such as 'System.Web', 'System.IO', 'System.Web.UI', 'System.Web.UI.WebControls', etc. A control client id filter is specified by an array of control client id A message whose control client id starts with any filtering naming panels will be deleted. For example, a category filter array('ctl0_body_header', 'ctl0_body_content_sidebar') will delete messages under categories such as 'ctl0_body_header', 'ctl0_body_content_sidebar', 'ctl0_body_header_title', 'ctl0_body_content_sidebar_savebutton', etc. A timestamp filter is specified as an interger or float number. A message whose registered timestamp is less or equal the filter value will be returned. Level filter, category filter, control filter and timestamp filter are combinational, i.e., only messages satisfying all filter conditions will they be returned.

  • access: public
void deleteLogs ([integer $levels = null], [array $categories = null], [array $controls = null], [ $timestamp = null])
  • integer $levels: level filter
  • array $categories: category filter
  • array $controls: control filter
  • $timestamp
getLogs (line 113)

Retrieves log messages.

Messages may be filtered by log levels and/or categories and/or control client ids and/or timestamp. 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 an array of categories to filter. A message whose category name starts with any filtering category will be returned. For example, a category filter array('System.Web','System.IO') will return messages under categories such as 'System.Web', 'System.IO', 'System.Web.UI', 'System.Web.UI.WebControls', etc. A control client id filter is specified by an array of control client id A message whose control client id starts with any filtering naming panels will be returned. For example, a category filter array('ctl0_body_header', 'ctl0_body_content_sidebar') will return messages under categories such as 'ctl0_body_header', 'ctl0_body_content_sidebar', 'ctl0_body_header_title', 'ctl0_body_content_sidebar_savebutton', etc. A timestamp filter is specified as an interger or float number. A message whose registered timestamp is less or equal the filter value will be returned. Level filter, category filter, control filter and timestamp filter are combinational, i.e., only messages satisfying all filter conditions will they be returned.

  • return: 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)); [4] => memory in bytes [5] => control client id
  • access: public
array getLogs ([integer $levels = null], [array $categories = null], [array $controls = null], [ $timestamp = null])
  • integer $levels: level filter
  • array $categories: category filter
  • array $controls: control filter
  • $timestamp
log (line 68)

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|TControl $ctl = null])
  • 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
  • string|TControl $ctl: control 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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
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, 25 Jun 2012 14:38:39 +0200 by phpDocumentor 1.4.3