- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

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:
TBrowserLogRoute
TDataFieldAccessor
TDateTimeStamp
TDbLogRoute
TEmailLogRoute
TFileLogRoute
TFirebugLogRoute
TFirePhpLogRoute
TLogger
TLogRoute
TLogRouter
TParameterModule
TSimpleDateFormatter
TVarDumper

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 and log categories.

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

Method Summary
void | getLogs ( integer $levels, string $categories, array 2) Retrieves log messages.
void | log ( string $message, integer $level, string $category) 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::__get(), TComponent::__set()

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

Method Details

## getLogs

public void getLogs | (integer $levels , string $categories , array 2 )

Retrieves log messages.

Messages may be filtered by log levels and/or categories. 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 concatenating interested category names with commas. A message whose category name starts with any filtering category will be returned. For example, a category filter 'System.Web, System.IO' will return messages under categories such as 'System.Web', 'System.IO', 'System.Web.UI', 'System.Web.UI.WebControls', etc. Level filter and category filter are combinational, i.e., only messages satisfying both filter conditions will they be returned.

Input
integer | $levels | level filter
string | $categories | category filter
array | 2 | 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));
Output
Exception

## log

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

Logs a message.

Messages logged by this method may be retrieved via getLogs.

Input
string | $message | message to be logged
integer | $level | level of the message. Valid values include TLogger::DEBUG, TLogger::INFO, TLogger::NOTICE, TLogger::WARNING, TLogger::ERROR, TLogger::ALERT, TLogger::FATAL.
string | $category | category 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