PHP Class Prado\Util\TDbLogRoute

TDbLogRoute stores log messages in a database table. To specify the database table, set {@link setConnectionID ConnectionID} to be the ID of a {@link TDataSourceConfig} module and {@link setLogTableName LogTableName}. If they are not setting, an SQLite3 database named 'sqlite3.log' will be created and used under the runtime directory. By default, the database table name is 'pradolog'. It has the following structure: CREATE TABLE pradolog ( log_id INTEGER NOT NULL PRIMARY KEY, level INTEGER, category VARCHAR(128), logtime VARCHAR(20), message VARCHAR(255) );
Since: 3.1.2
Author: Qiang Xue ([email protected])
Inheritance: extends TLogRoute
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
__destruct ( ) Destructor.
getAutoCreateLogTable ( ) : boolean
getConnectionID ( ) : string
getDbConnection ( ) : TDbConnection
getLogTableName ( ) : string
init ( $config ) Initializes this module.
setAutoCreateLogTable ( $value )
setConnectionID ( $value ) Sets the ID of a TDataSourceConfig module.
setLogTableName ( $value ) Sets the name of the DB table to store log content.

Méthodes protégées

Méthode Description
createDbConnection ( ) : TDbConnection Creates the DB connection.
createDbTable ( ) Creates the DB table for storing log messages.
processLogs ( $logs ) Stores log messages into database.

Method Details

__destruct() public méthode

Disconnect the db connection.
public __destruct ( )

createDbConnection() protected méthode

Creates the DB connection.
protected createDbConnection ( ) : TDbConnection
Résultat Prado\Data\TDbConnection the created DB connection

createDbTable() protected méthode

Creates the DB table for storing log messages.
protected createDbTable ( )

getAutoCreateLogTable() public méthode

See also: setAutoCreateLogTable
public getAutoCreateLogTable ( ) : boolean
Résultat boolean whether the log DB table should be automatically created if not exists. Defaults to true.

getConnectionID() public méthode

public getConnectionID ( ) : string
Résultat string the ID of a {@link TDataSourceConfig} module. Defaults to empty string, meaning not set.

getDbConnection() public méthode

public getDbConnection ( ) : TDbConnection
Résultat Prado\Data\TDbConnection the DB connection instance

getLogTableName() public méthode

See also: setAutoCreateLogTable
public getLogTableName ( ) : string
Résultat string the name of the DB table to store log content. Defaults to 'pradolog'.

init() public méthode

This method is required by the IModule interface. It initializes the database for logging purpose.
public init ( $config )

processLogs() protected méthode

Stores log messages into database.
protected processLogs ( $logs )

setAutoCreateLogTable() public méthode

See also: setLogTableName
public setAutoCreateLogTable ( $value )

setConnectionID() public méthode

The datasource module will be used to establish the DB connection for this log route.
public setConnectionID ( $value )

setLogTableName() public méthode

Note, if {@link setAutoCreateLogTable AutoCreateLogTable} is false and you want to create the DB table manually by yourself, you need to make sure the DB table is of the following structure: (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)
See also: setAutoCreateLogTable
public setLogTableName ( $value )