PHP Class Prado\Util\TLogger

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.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends Prado\TComponent
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
deleteLogs ( $levels = null, $categories = null, $controls = null, $timestamp = null ) Deletes log messages from the queue.
getLogs ( $levels = null, $categories = null, $controls = null, $timestamp = null ) : array Retrieves log messages.
log ( $message, $level, $category = 'Uncategorized', $ctl = null ) Logs a message.

Private Methods

Méthode Description
filterByCategories ( $value ) Filter function used by {@link getLogs}.
filterByControl ( $value ) Filter function used by {@link getLogs}
filterByLevels ( $value ) Filter function used by {@link getLogs}
filterByTimeStamp ( $value ) Filter function used by {@link getLogs}

Method Details

deleteLogs() public méthode

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.
public deleteLogs ( $levels = null, $categories = null, $controls = null, $timestamp = null )

getLogs() public méthode

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.
public getLogs ( $levels = null, $categories = null, $controls = null, $timestamp = null ) : array
Résultat 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

log() public méthode

Messages logged by this method may be retrieved via {@link getLogs}.
public log ( $message, $level, $category = 'Uncategorized', $ctl = null )