кемерово-ман/log-вендор

此包的最新版本(6.0.1)没有可用的许可证信息。


README

添加到项目中的功能:可以直接在文本文件和json中记录日志,并在浏览器中读取json日志。配置在config/log.php中。添加项目路由:/logs - 日志列表,/logs/{file} - 查看json日志

安装

  1. 执行
require kemerovo-man/log-vendor

对于 Laravel 5.7

    "require": {
        "kemerovo-man/log-vendor": "5.7.*"
    }

对于 Laravel 5.8

    "require": {
        "kemerovo-man/log-vendor": "5.8.*"
    }
  1. 添加到app.conf中
    'providers' => [
        KemerovoMan\LogVendor\LogVendorServiceProvider::class
    ]
  1. php artisan vendor:publish

  2. 配置config/log.php

可以使用中间件关闭路由 /logs, /logs/{file}

例如

'middleware' => ['web', 'auth']
  1. 编写配置文件为所有日志并添加到门面(facade)的方法

  2. 可以修改Exceptions/Handler.php

    public function report(Exception $exception)
    {
        if ($this->shouldntReport($exception)) {
            return;
        }
        parent::report($exception);
        \Log::laravelReport($exception);
    }