akbsit / laravel-system-log
Write logs data in app.
1.0.9
2024-04-06 11:44 UTC
Requires
- php: ^8.1
- akbsit/helper-json: ^1.0
- laravel/framework: ^9.0|^10.0|^11.0
README
It is used for working with logging data, recording logs.
Install
To install package, you need run command:
composer require akbsit/laravel-system-log
Examples
Recording logs
use Akbsit\SystemLog\SystemLog; $arData = [ 'some_data' => 1 ]; SystemLog::write() ->enableSimpleInfo() ->setInfo(['method' => __METHOD__]) ->setData(['$arData' => $arData]) ->setMessage('Some log message') ->put();
Methods
setNameSpace($sNameSpace)
- specifying the read space:$sNameSpace
- name of the space (by defaultdefault
).
enableSimpleInfo()
- enable minimum set of call location logging;setInfo($arInfo)
- specifying information about the logging location:$arInfo
- array data.
setData($arData)
- specifying logging data:$arData
- array data.
setMessage($sMessage)
- specifying the logging message:$sMessage
- message.
setType($sType)
- specifying the logging type:$sType
- type (by defaulterror
).
put()
- create record.
Reading logs
use Akbsit\SystemLog\SystemLog; $oSystemLog = SystemLog::read() ->setNameSpace(SystemLog::NAMESPACE_API);
Methods
setNameSpace($sNameSpace)
- specifying the read space:$sNameSpace
- name of the space.
getSize()
- get the size of logs in space;getAllSize()
- get the size of logs;delete()
- clear logs in space;deleteAll()
- clear logs;getList()
- get a list of logs in the space.