承接 pablo1gustavo/monolog-seq 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pablo1gustavo/monolog-seq

最新稳定版本:1.0.1

Composer 安装命令:

composer require pablo1gustavo/monolog-seq

包简介

Integrates Monolog with Seq using HTTP ingestion, enabling structured event logging to a centralized Seq server for enhanced log management.

README 文档

README

Integrates PHP Monolog with Seq using HTTP ingestion, enabling structured event logging to a centralized Seq server for enhanced log management.

Installation

Install the latest version with

composer require pablo1gustavo/monolog-seq

Usage

This package automatically sets the CLEF request keys, including @t, @m, @mt, @l, and @x, ensuring seamless structured logging.

For more detailed usage instructions, refer to the official Seq documentation.

Usage (Vanilla PHP)

You can find an example in example.php.

$seqUrl = "http://localhost:5341/api/events/raw";
$seqApiKey = "H16XK1wLgC0LDsen5fwA";

$logger = new Logger('seq');
$logger->pushHandler(new SeqHandler($seqUrl, $seqApiKey));

$logger->critical('error', ['excepasdtion' => new Exception('error')]);
$logger->warning('warn message', ['abc' => "123", 'def' => [1,2,3]]); 
$logger->info("hello my name is {name}", ['name' => 'pablo']);
$logger->debug("debug message", ['date' => new DateTime("2002-01-13")]);
$logger->emergency("teste");

Usage (Laravel)

Laravel allows you to configure custom Monolog handlers, such as this package, within its logging configuration file.

For step-by-step instructions, refer to the Laravel Logging - Creating Monolog Handler Channels documentation.

Example:

        'seq' => [
            'driver' => 'monolog',
            'level' => env('LOG_LEVEL', 'debug'),
            'handler' => \Pablo1Gustavo\MonologSeq\Handler\SeqHandler::class,
            'formatter' => \Pablo1Gustavo\MonologSeq\Formatter\SeqJsonFormatter::class,
            'with' => [
                'url' => env('SEQ_URL'),
                'apiKey' => env('SEQ_API_KEY'),
            ],
        ]

统计信息

  • 总下载量: 782
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-02