PHP Класс 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) );
С версии: 3.1.2
Автор: Qiang Xue ([email protected])
Наследование: extends TLogRoute
Показать файл Открыть проект

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
createDbConnection ( ) : TDbConnection Creates the DB connection.
createDbTable ( ) Creates the DB table for storing log messages.
processLogs ( $logs ) Stores log messages into database.

Описание методов

__destruct() публичный Метод

Disconnect the db connection.
public __destruct ( )

createDbConnection() защищенный Метод

Creates the DB connection.
protected createDbConnection ( ) : TDbConnection
Результат Prado\Data\TDbConnection the created DB connection

createDbTable() защищенный Метод

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

getAutoCreateLogTable() публичный Метод

См. также: setAutoCreateLogTable
public getAutoCreateLogTable ( ) : boolean
Результат boolean whether the log DB table should be automatically created if not exists. Defaults to true.

getConnectionID() публичный Метод

public getConnectionID ( ) : string
Результат string the ID of a {@link TDataSourceConfig} module. Defaults to empty string, meaning not set.

getDbConnection() публичный Метод

public getDbConnection ( ) : TDbConnection
Результат Prado\Data\TDbConnection the DB connection instance

getLogTableName() публичный Метод

См. также: setAutoCreateLogTable
public getLogTableName ( ) : string
Результат string the name of the DB table to store log content. Defaults to 'pradolog'.

init() публичный Метод

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

processLogs() защищенный Метод

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

setAutoCreateLogTable() публичный Метод

См. также: setLogTableName
public setAutoCreateLogTable ( $value )

setConnectionID() публичный Метод

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

setLogTableName() публичный Метод

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)
См. также: setAutoCreateLogTable
public setLogTableName ( $value )