The ezcLogDatabaseWriter provides an implementation to write log messages to the database.
Example to use the ezcLogDatabaseWriter:
Source for this file: /EventLogDatabaseTiein/src/writers/writer_database.php
Version: | //autogentag// |
string | read/write |
$category
The name of the column category. |
string | read/write |
$datetime
The name of the column datetime. |
string | read/write |
$message
The name of the column message. |
string | read/write |
$severity
The name of the column severity. |
string | read/write |
$source
The name of the column source. |
string | read/write |
$table
The table name. |
public ezcLogDatabaseWriter |
__construct(
$databaseInstance
, [ $defaultTable
= false] )
Construct a new database log-writer. |
public array(string=>string) |
getColumnTranslations(
)
Returns an array that describes the coupling between the logMessage information and the columns in the database. |
public void |
setTable(
$logFilter
, $tableName
)
Maps the table $tableName to the messages specified by the ezcLogFilter $logFilter. |
public void |
writeLogMessage(
$message
, $severity
, $source
, $category
, [ $optional
= array()] )
Writes the message $message to the log. |
Construct a new database log-writer.
If $databaseInstance is given, that instance will be used for writing. If it is omitted the default database instance will be retrieved.
This constructor is a tie-in.
Name | Type | Description |
---|---|---|
$databaseInstance |
ezcDbHandler | |
$defaultTable |
string |
Returns an array that describes the coupling between the logMessage information and the columns in the database.
Maps the table $tableName to the messages specified by the ezcLogFilter $logFilter.
Log messages that matches with the filter are written to the table $tableName. This method works the same as ezclog::map().
Name | Type | Description |
---|---|---|
$logFilter |
ezcLogFilter | |
$tableName |
string |
Writes the message $message to the log.
The writer can use the severity, source, and category to filter the incoming messages and determine the location where the messages should be written.
$optional may contain extra information that can be added to the log. For example: line numbers, file names, usernames, etc.
Name | Type | Description |
---|---|---|
$message |
string | |
$severity |
int | ezcLog:: DEBUG, SUCCES_AUDIT, FAILED_AUDIT, INFO, NOTICE, WARNING, ERROR or FATAL. $param string $source |
$category |
string | |
$optional |
array(string=>string) | |
$source |
Type | Description |
---|---|
ezcLogWriterException |
If the log writer was unable to write the log message |