Class TLogRoute
Direct Known Sub-classes:
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.
Method Summary |
void
|
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
|
|
integer
|
|
protected
integer
|
|
void
|
Initializes the route.
|
protected
abstract
void
|
Processes log messages and sends them to specific destination.
|
void
|
|
void
|
|
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 | $logger | logger instance |
Output |
Exception |
|
formatLogMessage
protected string formatLogMessage |
(string $message , integer $level , string $category , integer $time ) |
Formats a log message given different fields.
Input |
string | $message | message content |
integer | $level | message level |
string | $category | message category |
integer | $time | timestamp |
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 | $level | level value |
Output |
string
| level name |
Exception |
|
getLevels
public integer getLevels |
() |
Output |
integer
| log level filter |
Exception |
|
getLevelValue
protected integer getLevelValue |
(string $level ) |
Input |
string | $level | level name |
Output |
integer
| level value |
Exception |
|
init
Initializes the route.
|
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 | $logs | list 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 | $categories | list 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 | $levels | integer 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 |
|
|