Db
extends AbstractWriter
in package
Db log writer class
Tags
Table of Contents
- $db : AbstractAdapter
- DB adapter
- $limit : int
- Log limit
- $table : string
- Table
- __construct() : mixed
- Constructor
- getContext() : string
- Get context for log
- getLogLimit() : int
- Get log limit
- hasLogLimit() : bool
- Has log limit
- isWithinLogLimit() : bool
- Check if a log level is within the set log level limit
- setLogLimit() : AbstractWriter
- Set log limit
- writeLog() : Db
- Write to the log
- createTable() : void
- Create table in database
Properties
$db
DB adapter
protected
AbstractAdapter
$db
= null
$limit
Log limit
protected
int
$limit
= null
$table
Table
protected
string
$table
= 'pop_log'
Methods
__construct()
Constructor
public
__construct(AbstractAdapter $db[, string $table = 'pop_log' ]) : mixed
Instantiate the DB writer object
The DB table requires the following fields at a minimum: timestamp DATETIME level INT name VARCHAR message TEXT, VARCHAR, etc. context TEXT, VARCHAR, etc.
Parameters
- $db : AbstractAdapter
- $table : string = 'pop_log'
Return values
mixed —getContext()
Get context for log
public
getContext([array<string|int, mixed> $context = [] ]) : string
Parameters
- $context : array<string|int, mixed> = []
Return values
string —getLogLimit()
Get log limit
public
getLogLimit() : int
Return values
int —hasLogLimit()
Has log limit
public
hasLogLimit() : bool
Return values
bool —isWithinLogLimit()
Check if a log level is within the set log level limit
public
isWithinLogLimit(int $level) : bool
Parameters
- $level : int
Return values
bool —setLogLimit()
Set log limit
public
setLogLimit(int $level) : AbstractWriter
Parameters
- $level : int
Return values
AbstractWriter —writeLog()
Write to the log
public
writeLog(mixed $level, string $message[, array<string|int, mixed> $context = [] ]) : Db
Parameters
- $level : mixed
- $message : string
- $context : array<string|int, mixed> = []
Return values
Db —createTable()
Create table in database
protected
createTable() : void