定制 wendelulhoa/laravel-discord-logger-simple 二次开发

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

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

wendelulhoa/laravel-discord-logger-simple

Composer 安装命令:

composer require wendelulhoa/laravel-discord-logger-simple

包简介

Logging to a discord channel in Laravel

README 文档

README

Latest Version on Packagist Software License Total Downloads

wu/laravel-discord-logger-simple is a laravel package providing a logging handler to send logs to a Discord channel.

Installation

You can install the package via composer:

composer wendelulhoa/laravel-discord-logger-simple

Setup

// config/app.php
'providers' => [
    ...
    Wendelulhoa\WuDiscordLogger\ServiceProviderWuDiscordLogger::class
];

Prepare the discord channel web hook

Create a discord web hook for the channel which will receive the logs.

Prepare the logger configuration

You must add a new channel to your config/logging.php file:

// config/logging.php
'channels' => [
    //...
    'discord' => [
        'driver' => 'custom',
        'via'    => WU\WuDiscordLogger\WuDiscordLogger::class,
        'level'  => 'debug',
        'url'    => env('LOG_DISCORD_WEBHOOK_URL'),
        'ignore_exceptions' => env('LOG_DISCORD_IGNORE_EXCEPTIONS', false),
    ],
];

You can then provide the web-hook URL in your .env file:

LOG_DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/abcerd/1234

You can then publish the configuration file:

php artisan vendor:publish --provider "Wendelulhoa\WuDiscordLogger\ServiceProviderWuDiscordLogger"

Use the logger channel

You have two options: log only to discord or add the channel to the stack

Logging to multiple Discord channels

Of course, you can send your log messages to multiple Discord channels. Just create as many channels as desired in config/logging.php and put them in the stack. Each channel should be named differently and should point to a different web hook URL.

Version history

See the dedicated change log

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-11