pclib
3.2.0
Lightweight PHP framework
|
This class offers fast and space-saving database logger. More...
Public Member Functions | |
__construct ($name=null) | |
log ($category, $message_id, $message=null, $item_id=null) | |
Store message to the log. More... | |
getLog ($rowCount, array $filter=null) | |
Return last $rowcount records from the log. More... | |
getSize () | |
Return size of the log in MB. More... | |
deleteLog ($keepDays, $allLogs=false) | |
Remove old records in log. More... | |
![]() | |
loadDefaults ($className=null) | |
Load default parameters of class $className into object instance. | |
setProperties (array $defaults) | |
Set public properties of object from the array. More... | |
toArray () | |
Convert object to array. More... | |
Data Fields | |
$name = 'LOGGER' | |
Name of the logger. | |
$storage | |
var LoggerDbStorage | |
$auth | |
var Auth | |
![]() | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions | |
getStorage () | |
Return storage object - if not exists, create one. | |
![]() | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Protected Attributes | |
$app | |
var App | |
Additional Inherited Members | |
![]() | |
static | defaults () |
Set or retireve default parameters of the object. More... | |
This class offers fast and space-saving database logger.
You can store any program events (actions) alltogether with user_id, item_id, browser, ip-address or even with additional message. Only numerical ID are stored into LOG so it is very compact. The lookup table which contains text labels bounded with IDs is updated automatically.
__construct | ( | $name = null | ) |
$name | Logger name (Same as application name by default) |
deleteLog | ( | $keepDays, | |
$allLogs = false |
|||
) |
Remove old records in log.
It will keep $keepdays in the log.
int | $keepDays | Number of days to keep in the log |
bool | $allLogs | This logger only / all loggers |
getLog | ( | $rowCount, | |
array | $filter = null |
||
) |
Return last $rowcount records from the log.
int | $rowCount | Number of rows |
array | $filter | Set filter on USER,ACTION,LOGGER. Ex: array('USER'=>'joe') |
getSize | ( | ) |
Return size of the log in MB.
log | ( | $category, | |
$message_id, | |||
$message = null , |
|||
$item_id = null |
|||
) |
Store message to the log.
string | $category | Message category such as AUTH_WARNING or PHP_ERROR. |
string | $message_id | For logging repeated events such as 'user/delete' |
string | $message | Fill it if you need log full text message |
int | $item_id | Additional id of related object |