radoslawkoziol/monolog-masstrade

Monolog MassTrade 处理器

1.0.1 2021-01-13 08:23 UTC

This package is auto-updated.

Last update: 2024-09-13 16:16:04 UTC


README

  • 安装包
  • 在 Laravel 的 config/logging.php 中添加日志通道
'masstrade' => [
     'driver' => 'custom',
     'via' => radoslawkoziol\MonologMassTrade\MasstradeLogger::class,
     'level' => 'debug'
],
  • 如果未配置,则必须配置 daily 通道
'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
    'days' => 7,
],
  • 默认日志通道不能设置为 masstrade
  • .env 中添加公开 API URL:PUBLIC_API_MT_URL=https://public-api.masstrade.pl

使用

radoslawkoziol\MonologMassTrade\MassTradeLog::error($exception);

可选

要使错误处理程序正常工作,在文件 app/Exceptions/Handler.php 中添加

public function report(Throwable $exception)
{
    if ($this->shouldReport($exception)) {
        radoslawkoziol\MonologMassTrade\MassTradeLog::error($exception);
    }
    parent::report($exception);
}