承接 inoovum/log-throwable 相关项目开发

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

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

inoovum/log-throwable

最新稳定版本:1.0.3

Composer 安装命令:

composer require inoovum/log-throwable

包简介

inoovum® throwable log package

README 文档

README

This package extends the throwable log.

Installation

Just run: composer require inoovum/log-throwable

Configuration

You can define your own PHP classes. The Neos Flow exception messages will be passed to them. For example, to a specific slack channel.

Inoovum:
  Log:
    Throwable:
      options:
        writeToFile: false # Disable writing log files to local storage
      classes:
        -
          class: 'Inoovum\Log\Throwable\Log\SlackMessage'
          options:
            webhookUri: 'https://hooks.slack.com/services/T1TCCUN3X/A17PWTYX3GZ/xs83nHlpZafgUieYzsKiUcfa'

Custom throwable class

<?php
namespace Inoovum\Log\Throwable\Log;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Neos\Flow\Annotations as Flow;

class SlackMessage implements ThrowableInterface
{

    /**
     * @param string $errorInfo
     * @param array $options
     * @return void
     * @throws GuzzleException
     */
    public function throwError(string $errorInfo, array $options): void
    {
        $client = new Client();
        $url = $options['webhookUri'];
        $client->post($url, [
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'json' => [
                'text' => $errorInfo
            ]
        ]);
    }

}

Author

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-03-13