margatampu/laravel-teams-logging 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

margatampu/laravel-teams-logging

Composer 安装命令:

composer require margatampu/laravel-teams-logging

包简介

Laravel handler to sending messages to Microsoft Teams using the Incoming Webhook connector

README 文档

README

Software License

Laravel handler to sending messages to Microsoft Teams using the Incoming Webhook connector.

Installation

Require this package with composer.

$ composer require margatampu/laravel-teams-logging

Integration

Package tested and worked with Laravel and Lumen framework (10+).

Laravel: After installation using composer finishes up, you'll have to add the following line to your config/app.php:

MargaTampu\LaravelTeamsLogging\LoggerServiceProvider::class

Lumen: For Lumen, you'll have to add the following line to your bootstrap/app.php:

$app->register(MargaTampu\LaravelTeamsLogging\LoggerServiceProvider::class);

Laravel: Then copy teams config file from laravel-teams-logging to your config folder:

$ php artisan vendor:publish --provider="MargaTampu\LaravelTeamsLogging\LoggerServiceProvider"

Lumen: For Lumen, you need to copy file manually to your config folder and enable it in bootstrap/app.php:

$app->configure('teams');

Create a custom channel using laravel logging file or create new logging config file for lumen.

Add this configuration to config/logging.php file

'teams' => [
    'driver'    => 'custom',
    'via'       => \MargaTampu\LaravelTeamsLogging\LoggerChannel::class,
    'level'     => 'debug',
    'url'       => env('INCOMING_WEBHOOK_URL'),
    'style'     => 'simple',    // Available style is 'simple' and 'card', default is 'simple'
],

or simply add name to specify different project name for each connector.

'teams' => [
    'driver'    => 'custom',
    'via'       => \MargaTampu\LaravelTeamsLogging\LoggerChannel::class,
    'level'     => 'debug',
    'url'       => env('INCOMING_WEBHOOK_URL'),
    'style'     => 'simple',    // Available style is 'simple' and 'card', default is 'simple'
    'name'      => 'Dummy Project'
],

There are 2 available styles for microsoft teams message, using simple and card. You can see card style in results style which is difference from simple style.

After added configs to your config/logging.php file, add INCOMING_WEBHOOK_URL variable to your .env file with connector url from your microsoft teams connector. Please read microsoft teams document to find your connector url.

Usage

To send a simple error message to teams channel, you kindly use script below:

Log::channel('teams')->error('Error message');

Or you can include additional info to card message using log context.

Log::channel('teams')->error('Error message', [
    'name'  => 'value',
    'Assigned to' => 'Unassigned'
]);

When using simple style, log context will ignore from message.

You can also add teams to the default stack channel so all errors are automatically send to the teams channel.

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'teams'],
    ],
],

Results

Here are some results of notifications sent to microsoft teams channel using card style.

  • Debug log preview in microsoft teams channel Screenshot

  • Info log preview in microsoft teams channel Screenshot

  • Notice log preview in microsoft teams channel Screenshot

  • Warning log preview in microsoft teams channel Screenshot

  • Error log preview in microsoft teams channel Screenshot

  • Critical log preview in microsoft teams channel Screenshot

  • Alert log preview in microsoft teams channel Screenshot

  • Emergency log preview in microsoft teams channel Screenshot

License

This laravel-teams-logging package is available under the MIT license. See the LICENSE file for more info.

margatampu/laravel-teams-logging 适用场景与选型建议

margatampu/laravel-teams-logging 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 824.2k 次下载、GitHub Stars 达 45, 最近一次更新时间为 2018 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 margatampu/laravel-teams-logging 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 margatampu/laravel-teams-logging 我们能提供哪些服务?
定制开发 / 二次开发

基于 margatampu/laravel-teams-logging 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 45
  • Watchers: 1
  • Forks: 35
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-25