Packages:
default
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.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TLogRoute

TComponent
   |
   --TApplicationComponent
      |
      --TLogRoute

TLogRoute class.

TLogRoute is the base class for all log route classes. A log route object retrieves log messages from a logger and sends it somewhere, such as files, emails. The messages being retrieved may be filtered first before being sent to the destination. The filters include log level filter and log category filter.

To specify level filter, set Levels property, which takes a string of comma-separated desired level names (e.g. 'Error, Debug'). To specify category filter, set Categories property, which takes a string of comma-separated desired category names (e.g. 'System.Web, System.IO').

Level filter and category filter are combinational, i.e., only messages satisfying both filter conditions will they be returned.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
void
collectLogs ( TLogger $logger)
Retrieves log messages from logger to log route specific destination.
protected  string
formatLogMessage ( string $message, integer $level, string $category, integer $time)
Formats a log message given different fields.
array
protected  string
getLevelName ( integer $level)
integer
protected  integer
getLevelValue ( string $level)
void
init ( TXmlElement $config)
Initializes the route.
protected  abstract  void
processLogs ( array $logs)
Processes log messages and sends them to specific destination.
void
setCategories ( array|string $categories)
void
setLevels ( integer|string $levels)
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
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()

Method Details

collectLogs

public void collectLogs (TLogger $logger )

Retrieves log messages from logger to log route specific destination.

Input
TLogger$loggerlogger instance
Output
Exception

formatLogMessage

protected string formatLogMessage (string $message , integer $level , string $category , integer $time )

Formats a log message given different fields.

Input
string$messagemessage content
integer$levelmessage level
string$categorymessage category
integer$timetimestamp
Output
string formatted message
Exception

getCategories

public array getCategories ()

Output
array list of categories to be looked for
Exception

getLevelName

protected string getLevelName (integer $level )

Input
integer$levellevel value
Output
string level name
Exception

getLevels

public integer getLevels ()

Output
integer log level filter
Exception

getLevelValue

protected integer getLevelValue (string $level )

Input
string$levellevel name
Output
integer level value
Exception

init

public void init (TXmlElement $config )

Initializes the route.

Input
TXmlElement$configconfigurations specified in TLogRouter.
Output
Exception

processLogs

protected abstract void processLogs (array $logs )

Processes log messages and sends them to specific destination.

Derived child classes must implement this method.

Input
array$logslist of messages. Each array elements represents one message with the following structure: array( [0] => message [1] => level [2] => category [3] => timestamp);
Output
Exception

setCategories

public void setCategories (array|string $categories )

Input
array|string$categorieslist of categories to be looked for. If the value is a string, it is assumed to be comma-separated category names.
Output
Exception

setLevels

public void setLevels (integer|string $levels )

Input
integer|string$levelsinteger log level filter (in bits). If the value is a string, it is assumed to be comma-separated level names. Valid level names include 'Debug', 'Info', 'Notice', 'Warning', 'Error', 'Alert' and 'Fatal'.
Output
Exception