mbpcoder/laravel-monolog-rocketchat
最新稳定版本:v1.0.1
Composer 安装命令:
composer require mbpcoder/laravel-monolog-rocketchat
包简介
Rocket Chat Handler for Monolog
README 文档
README
ScreenShot
❓ Why Another Logger?
Logging should be more than just saving data — it should drive action. Here’s why 🔔 Rocket Chat Handler for Monolog 📝 is a game-changer:
- 🚀 Real-Time Feedback – Instantly receive logs in your Rocket Chat.
- 🧠 Actionable Insights – Include useful context for quick understanding.
- 🛡️ No Need for Sentry or Third-Party Services
- ⚡ Immediate Alerts – Be notified of issues the moment they happen.
- 👥 Team Collaboration – Share logs in group chats for quick follow-up.
🎯 Installation
Install via Composer:
composer require mbpcoder/laravel-monolog-rocketchat
⚙️ Usage
Update your config/logging.php file to configure the Rocket Chat logging channel.
⏳ Running Logs in a Queue
If a queue name is set, logs will be processed asynchronously in the specified queue. Otherwise, they will run synchronously.
🔧 Configuration Example
Modify your config/logging.php file:
return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'rocketchat'], ], 'rocketchat' => [ 'driver' => 'monolog', 'level' => 'debug', 'handler' => TheCoder\MonologRocketChat\RocketChatBotHandler::class, 'handler_with' => [ 'token' => env('LOG_ROCKET_CHAT_BOT_TOKEN'), 'chat_id' => env('LOG_ROCKET_CHAT_CHAT_ID'), 'api_url' => env('LOG_ROCKET_CHAT_BOT_API'), 'queue' => env('LOG_ROCKET_CHAT_QUEUE', null) 'queue_connection' => env('LOG_ROCKET_CHAT_QUEUE_CONNECTION', null), ], 'formatter' => TheCoder\MonologRocketChat\RocketChatFormatter::class, 'formatter_with' => [ 'tags' => env('LOG_ROCKET_CHAT_TAGS', null), ], ], ], ];
🔄 Customizing Log Settings at Runtime
You can dynamically set the bot token, chat ID while logging:
logger('message', [ 'token' => 'your_bot_token', 'chat_id' => 'your_chat_id' ]);
📜 Environment Variables
Ensure the following variables are set in your .env file:
LOG_ROCKET_CHAT_BOT_TOKEN= LOG_ROCKET_CHAT_CHAT_ID= LOG_ROCKET_CHAT_BOT_API=
📄 License
This package is open-source and available under the MIT License. 🏆
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-17