santran/smartlogs

Create Smart Logs for Laravel 5 Web or API application.

1.0 2016-11-18 15:04 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:42:05 UTC


README

Total Downloads Paypal Donate

Log look like preview

The best Log for Laravel 5.2.x and above. Install with composer.

Install (Laravel)

Install via composer

composer require santran/smartlogs:dev-master

Add Service Provider to config/app.php in providers section

SanTran\SmartLogs\SmartLogsServiceProvider::class,

Add Facade to config/app.php in aliases section:

'SmartLogs' => SanTran\SmartLogs\SmartLogsFacade::class,

Publish config file, open console and enter bellow command:

php artisan vendor:publish

Config file 'smartlogs.php' will be copy to config/smartlogs.php, you can change any config on that file for SmartLogs

- 'log_path'                          : Path to save file log
- 'log'                               : Log daily or single file
- 'log_option_on'                     : Enable/Disable Option Log
- 'log_level_enable'                  : Level of logs (Have four Level 'DEBUG', 'INFO', 'WARNING', 'ERROR')
- 'log_file_name'                     : Name of file log
- 'log_condition' => true,            : Enable Log by user id or client IP
- 'list_user_id' => [1, 2]            : List user id accept to write log
- 'list_ip' => ['127.0.0.1', '::1']   : List IP accept to write log
- 'log_reverse' => false,             : Reverse condition write lo by user id and client ip

How to use ? Open your Controller or any where you want to write log. Add this line on above file, remember after 'namespace ...' keywork:

use SmartLogs;

Call to write log on your function:

SmartLogs::startLog($params)  : To write START log ($params is optional - Default is "START")

SmartLogs::finishLog($params)  : To write FINISH log ($params is optional - Default is "FINISH")

SmartLogs::appInfo($params)  : To write Information log ($params can be String or Array)

SmartLogs::appDebug($params)  : To write Debug log ($params can be String or Array)

SmartLogs::appWarning($params)  : To write Warning log ($params can be String or Array)

SmartLogs::appError($params)  : To write Error log ($params can be String or Array)

SmartLogs::optLog($params)  : To write Option log ($params can be String or Array)

SmartLogs::logRequest()     : To write Option log with all Request params

Features:

  • Update auto log lastest sql command
  • And more...