pclib
3.0.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, if it has allowed category. 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... | |
Public Member Functions inherited from BaseObject | |
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. | |
$disabled = false | |
If you set disabled to true, nothing will be written into log. | |
$categories = array('ALL') | |
Only messages with following categories will be logged. More... | |
$storage | |
var LoggerDbStorage | |
$auth | |
var Auth | |
Data Fields inherited from BaseObject | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions | |
getStorage () | |
Return storage object - if not exists, create one. | |
Protected Member Functions inherited from BaseObject | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Protected Attributes | |
$app | |
var App | |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseObject | |
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, if it has allowed category.
Only categories in logger->categories will be logged. You can use your own categories too.
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 |
$categories = array('ALL') |
Only messages with following categories will be logged.
By default, all categories are logged.