定制 hmoreira10/logsnag-logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hmoreira10/logsnag-logger

Composer 安装命令:

composer require hmoreira10/logsnag-logger

包简介

Canal de log personalizado do Laravel para envio ao LogSnag via HTTP

README 文档

README

A custom Laravel logging channel that sends logs directly to the LogSnag API via HTTP using Monolog.

Description

This package provides an easy way to integrate Laravel's logging system with LogSnag, allowing you to send structured log events directly to your LogSnag project. It leverages Monolog's custom handlers and Laravel's logging channels for seamless integration.

Installation

Install the package via Composer:

composer require hmoreira10/logsnag-logger:dev-main

Configuration

Add the custom log channel to your config/logging.php file:

'channels' => [
    // other channels...

    'logsnag-your-channel' => [
        'driver' => 'custom',
        'via' => LogSnag\Logger\LogSnagLogger::class,
        'level' => 'info',
        'token' => env('LOGSNAG_TOKEN'),
        'project' => env('LOGSNAG_PROJECT'),
        'channel' => 'your-channel'
    ],
],

Then add the required environment variables to your .env file:

LOGSNAG_TOKEN=your-logsnag-api-token
LOGSNAG_PROJECT=your-logsnag-project

Usage

Use the custom log channel in your Laravel application like this:

use Illuminate\Support\Facades\Log;

Log::channel('logsnag')->info('Important event happened', [
    'notify' => false
    'icon' => '💰',
]);

Notes

  • Logs are sent synchronously.
  • Customize notify, channel, and icon via context.
  • Requires Laravel 10+ and PHP 8.1+.

License

MIT License

统计信息

  • 总下载量: 376
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-21