farhad/log-rhythm

为Laravel-MySQL定制的Monolog库。

dev-master 2019-04-08 12:06 UTC

This package is not auto-updated.

Last update: 2024-09-19 17:02:25 UTC


README

一个用于将日志信息存储在MySQL数据库中的工具,附带一些必要的信息。

此包存储的信息

  • 用户ID
  • 用户IP
  • 用户输入(可选)
  • URL
  • HTTP方法
  • 日志级别
  • 日志消息
  • 堆栈跟踪(可选)
  • 请求引用/来源

内容

安装

  1. 要安装LogRhythm,请运行以下命令

    composer require farhad/log-rhythm
  2. 对于Laravel版本 > 5.5,'ServiceProvider' 将自动添加。

  3. 运行以下命令加载所有配置文件

    php artisan vendor:publish --provider="Farhad\LogRhythm\LogRhythmServiceProvider"
  4. 发布更新后,将您的配置更新为选择此包进行日志记录。要将日志通道更改为LogRhythm,请在config/logging.php中的通道数组中添加logrhythm

    protected $channels = [
            ... ... ... ... ...
            ... ... ... ... ...
         'logrhythm' => [
             'driver' => 'custom',
             'via' => \Farhad\LogRhythm\LogRhythmChannel::class,
         ],
      
        ];
  5. 运行以下命令迁移数据库表

    php artisan migrate
  6. 更新您的.env(如果您缓存了env,则清除缓存以通过php artisan config:cache加载新设置)

    LOG_CHANNEL=logrhythm
  7. 您可以通过更新config/logrhythm.php文件来控制日志信息。

许可证

LogRhythm是免费软件,根据MIT许可证条款分发。