定制 senthilhep/hep-laravel-google-chat-log 二次开发

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

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

senthilhep/hep-laravel-google-chat-log

Composer 安装命令:

composer require senthilhep/hep-laravel-google-chat-log

包简介

Brings up the option for sending the logs to google chat [GSuite].

README 文档

README

♥ Made with <love/> And I love <code/>

Laravel/Lumen Google Chat Log

Brings up the option for sending the logs to google chat [GSuite] from Laravel/Lumen.

Installation

Composer install

composer require senthilhep/hep-laravel-google-chat-log

Add the following code to the channels array in config/logging.php in your laravel/lumen application.

'google-chat' => [
    'driver' => 'monolog',
    'url' => env('LOG_GOOGLE_CHAT_WEBHOOK_URL'),
    'notify_users' => [
        'default' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT'),
        'emergency' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_EMERGENCY'),
        'alert' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_ALERT'),
        'critical' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_CRITICAL'),
        'error' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_ERROR'),
        'warning' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_WARNING'),
        'notice' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_NOTICE'),
        'info' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_INFO'),
        'debug' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEBUG'),
    ],
    'level' => 'warning',
    'timezone' => env('LOG_GOOGLE_CHAT_TIMEZONE' , 'Asia/Kolkata'),
    'handler' => \Enigma\GoogleChatHandler::class,
],

You can provide the eight logging levels defined in the RFC 5424 specification: emergency, alert, critical, error, warning, notice, info, and debug

Note*: Make sure to set the LOG_GOOGLE_CHAT_WEBHOOK_URL env variable. And LOG_GOOGLE_CHAT_NOTIFY_USER_ID is optional. Here, you can set multiple google chat webhook url as comma separated value for the LOG_GOOGLE_CHAT_WEBHOOK_URL env variable.

Now, you can notify a specific user with @mention in the error log by setting the corresponding USER_ID to the LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT env variable. User Ids mapped under LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT will be notified for all log levels.

For getting the USER_ID, right-click the user-icon of the person whom you want to notify in the Google chat from your browser window and select inspect. Under the div element find the attribute data_member_id, then the USER_ID can be found as data-member-id="user/human/{USER_ID}>".

In order to notify all the users like @all, Set LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT=all. Also, you can set multiple USER_IDs as comma separated value. In order to notify different users for different log levels, you can set the corresponding env keys mentioned to configure in the logging.php file.

License

Copyright © Senthil Prabu

Laravel Google Chat Log is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-16