agtong/yii2-telegram-log-target
Composer 安装命令:
composer require agtong/yii2-telegram-log-target
包简介
Telegram log target for Yii 2
README 文档
README
Yii2 Telegram log target that sends selected log messages to the specified telegram chats or channels.
Installation
The preferred way to install this extension is through composer.
Either run
composer require agtong/yii2-telegram-log-target
or add
"agtong/yii2-telegram-log-target": "*"
to the require section of your composer.json file.
Usage
Add this log target to the components section in your configuration.
'components' => [
'log' => [
'targets' => [
[
'class' => 'agtong\yii2\log\TelegramTarget',
'botToken' => '123456:abcde',
'chatId' => '123456',
'levels' => ['error'],
'logVars' => [],
],
],
],
],
You can choose to disable this target by default,
'components' => [
'log' => [
'targets' => [
'telegramTarget => [ // Name this target
'class' => 'agtong\yii2\log\TelegramTarget',
'botToken' => '123456:abcde',
'chatId' => '123456',
'enabled' => false, // Disabled by default
'levels' => ['error'],
'logVars' => [],
],
],
],
],
and enable it when required.
Yii::$app->log->targets['telegramTarget']->enabled = true;
Yii::error('Hello World!');
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-19