muchrm/laravel-influxlog

将 Laravel 应用程序的错误记录到 InfluxDB

0.9.2 2018-08-28 17:52 UTC

This package is not auto-updated.

Last update: 2024-10-03 00:15:45 UTC


README

## 注意:本插件受到 swisnl/laravel-graylog2 的启发。我在我的项目中使用了它。请勿立即使用。

安装

  1. 运行以下命令安装此包: composer require muchrm/laravel-influxlog
  2. 如果您不喜欢自动发现,请将服务提供者添加到 app.php 中: Muchrm\InfluxLog\InfluxLogServiceProvider
  3. 运行 php artisan vendor:publish 将配置文件发布到 ./config/influxlog.php。
  4. 根据您的喜好进行配置
  5. 完成!

记录异常

默认设置启用异常记录。它将在 GELF 消息中添加 HTTP 请求,但不会添加 POST 值。检查 graylog2.log-requests 配置以启用或禁用此行为。

消息处理器

处理器为处理程序添加额外功能。您可以通过修改 AppServiceProvider 来注册处理器

public function register()
{
    //...
    InfluxLog::registerProcessor(new \Muchrm\InfluxLog\Processor\ExceptionProcessor());
    InfluxLog::registerProcessor(new \Muchrm\InfluxLog\Processor\RequestProcessor());
    InfluxLog::registerProcessor(new MyCustomProcessor());
    //...
}