smart-contact/sce-smart-log-client
Composer 安装命令:
composer require smart-contact/sce-smart-log-client
包简介
README 文档
README
Smart Log Client è un package Laravel che mette in comunicazione il sistema SmartLog per monitorare e analizzare eventuali log. Il pacchetto utilizza la libreria Monolog, già integrata in Laravel.
Questo pacchetto supporta le versioni di laravel >=7.x
Installazione
composer require smart-contact/smart-log-client
Publish config file
php artisan vendor:publish --tag="smartlog-client-config"
Configurazione Client
Il client necessita delle seguenti variabili env:
SMARTLOG_API_URL=https://smartlog.it SMARTLOG_APP_NAME="App Name"
| var | default | description |
|---|---|---|
| SMARTLOG_API_URL | Indica il dominio di smartlog a cui inviare i dati | |
| SMARTLOG_APP_NAME | Nome dell'applicazione in uso. Deve corrispondere al nome presente sull'app Smart Log, se non esiste verrà creata una nuova applicazione con il nome fornito. |
Configurazione Laravel Logging
Aggiungere il seguente codice nel file config/logging.php
return [ //... 'channels' => [ //... 'smartlog' => [ 'driver' => 'monolog', 'handler' => \SmartContact\SmartLogClient\LogHandlers\SmartLogHandler::class, 'level' => config('logging.level') ] ] ];
Utilizzo
Channel singolo
Impostare la variabile di ambiente LOG_CHANNEL a smartlog
// .env
LOG_CHANNEL=smartlog
Channel multiplo (stack)
Aggiungere ai channels, il channel 'smartlog`
... 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'smartlog'], 'ignore_exceptions' => false, ], ...
e settare la variabile LOG_CHANNEL
// .env
LOG_CHANNEL=stack
Generazione automatica dei log
Per generare dei log automatici dalle eccezioni lanciate da Laravel,
bisogna modificare il file app/Exceptions/Handler.php.
La classe Handler dovrà estendere la classe SmartLogClientException
Es.
// app/Exceptions/Handler.php <?php namespace App\Exceptions; use Throwable; use SmartContact\SmartLogClient\Exceptions\SmartLogClientException; class Handler extends SmartLogClientException{ //... }
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-01-25