PHP Class Prado\Util\TLogRoute

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 {@link setLevels Levels} property, which takes a string of comma-separated desired level names (e.g. 'Error, Debug'). To specify category filter, set {@link setCategories 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 ([email protected])
Inheritance: extends Prado\TApplicationComponent
Exibir arquivo Open project: pradosoft/prado Class Usage Examples

Protected Properties

Property Type Description
$_levelNames lookup table for level names
$_levelValues lookup table for level values

Public Methods

Method Description
collectLogs ( TLogger $logger ) Retrieves log messages from logger to log route specific destination.
getCategories ( ) : array
getLevels ( ) : integer
init ( $config ) Initializes the route.
setCategories ( $categories )
setLevels ( $levels )

Protected Methods

Method Description
formatLogMessage ( $message, $level, $category, $time ) : string Formats a log message given different fields.
getLevelName ( $level ) : string
getLevelValue ( $level ) : integer
processLogs ( $logs ) Processes log messages and sends them to specific destination.

Method Details

collectLogs() public method

Retrieves log messages from logger to log route specific destination.
public collectLogs ( TLogger $logger )
$logger TLogger

formatLogMessage() protected method

Formats a log message given different fields.
protected formatLogMessage ( $message, $level, $category, $time ) : string
return string formatted message

getCategories() public method

public getCategories ( ) : array
return array list of categories to be looked for

getLevelName() protected method

protected getLevelName ( $level ) : string
return string level name

getLevelValue() protected method

protected getLevelValue ( $level ) : integer
return integer level value

getLevels() public method

public getLevels ( ) : integer
return integer log level filter

init() public method

Initializes the route.
public init ( $config )

processLogs() abstract protected method

Derived child classes must implement this method.
abstract protected processLogs ( $logs )

setCategories() public method

public setCategories ( $categories )

setLevels() public method

public setLevels ( $levels )

Property Details

$_levelNames protected_oe static_oe property

lookup table for level names
protected static $_levelNames

$_levelValues protected_oe static_oe property

lookup table for level values
protected static $_levelValues