Packages:
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Javascripts
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Xml


Classes:
Keyword

Class TLogger

TComponent
   |
   --TLogger

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>
Since: 3.0

Method Summary
void
deleteLogs ( integer $levels, array $categories, array $controls, $timestamp)
Deletes log messages from the queue.
array
getLogs ( integer $levels, array $categories, array $controls, $timestamp)
Retrieves log messages.
void
log ( string $message, integer $level, string $category, string|TControl $ctl)
Logs a message.
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()

Constant Summary
int ALERT
int DEBUG Log levels.
int ERROR
int FATAL
int INFO
int NOTICE
int WARNING

Method Details

deleteLogs

public void deleteLogs (integer $levels , array $categories , array $controls , $timestamp )

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.

Input
integer$levelslevel filter
array$categoriescategory filter
array$controlscontrol filter
$timestamp
Output
Exception

getLogs

public array getLogs (integer $levels , array $categories , array $controls , $timestamp )

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.

Input
integer$levelslevel filter
array$categoriescategory filter
array$controlscontrol filter
$timestamp
Output
array 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
Exception

log

public void log (string $message , integer $level , string $category , string|TControl $ctl )

Logs a message.

Messages logged by this method may be retrieved via getLogs.

Input
string$messagemessage to be logged
integer$levellevel of the message. Valid values include TLogger::DEBUG, TLogger::INFO, TLogger::NOTICE, TLogger::WARNING, TLogger::ERROR, TLogger::ALERT, TLogger::FATAL.
string$categorycategory of the message
string|TControl$ctlcontrol of the message
Output
Exception


Constant Details

ALERT

Type:

int

Value:

0x20

DEBUG

Log levels.

Type:

int

Value:

0x01

ERROR

Type:

int

Value:

0x10

FATAL

Type:

int

Value:

0x40

INFO

Type:

int

Value:

0x02

NOTICE

Type:

int

Value:

0x04

WARNING

Type:

int

Value:

0x08