Telegram logging support removed.

This commit is contained in:
Alexey Skobkin 2019-01-19 04:11:01 +03:00
parent c2ccaad049
commit 9bcc3c6b24
6 changed files with 4 additions and 83 deletions

View file

@ -13,25 +13,12 @@ monolog:
main:
type: fingers_crossed
action_level: error
handler: main_grouped
main_grouped:
type: group
members: [rotated_file, telegram_deduplicated]
bubble: false
handler: rotated_file
rotated_file:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
max_files: 30
level: debug
telegram_deduplicated:
type: deduplication
action_level: error
handler: telegram
time: 600
telegram:
type: service
id: unreal4u\MonologHandler
action_level: error
# for commands
console:
type: console

View file

@ -35,8 +35,6 @@ parameters:
# Telegram bot
telegram_token: "123456:some-token"
telegram_max_connections: 2
# Telegram monolog handler
telegram_log_chat_id: ~
# Sentry
sentry_dsn: ~

View file

@ -100,8 +100,6 @@ services:
tags: [{ name: console.command }]
# Send message
Skobkin\Bundle\PointToolsBundle\Command\TelegramSendMessageCommand:
arguments:
$logChatId: '%telegram_log_chat_id%'
tags: [{ name: console.command }]
@ -188,12 +186,6 @@ services:
$logger: null
$client: '@app.http.telegram_client'
# Monolog handler
unreal4u\MonologHandler:
arguments:
$chatId: '%telegram_log_chat_id%'
$level: 'error'
# Private message processor
Skobkin\Bundle\PointToolsBundle\Service\Telegram\PrivateMessageProcessor:
arguments:

View file

@ -32,7 +32,6 @@
"knplabs/knp-paginator-bundle": "^2.5",
"unreal4u/telegram-api": "^2.2",
"csa/guzzle-bundle": "^3",
"unreal4u/monolog-telegram": "^0.2.0",
"symfony/web-server-bundle": "^3.3",
"sentry/sentry-symfony": "^2.2"
},

53
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ad4b1412bf70a26b450fa80443dd1fa2",
"content-hash": "c50bcdcd4c9deacaba7bb6c8456d6ce1",
"packages": [
{
"name": "composer/ca-bundle",
@ -4240,57 +4240,6 @@
"description": "Dummy logger that implements PSR-3 so that my own classes can work with a common base",
"time": "2018-01-08T13:02:56+00:00"
},
{
"name": "unreal4u/monolog-telegram",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/unreal4u/monolog-telegram.git",
"reference": "13c34ac16e9dad06e632ca8ed8aeee2d44663e5c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/unreal4u/monolog-telegram/zipball/13c34ac16e9dad06e632ca8ed8aeee2d44663e5c",
"reference": "13c34ac16e9dad06e632ca8ed8aeee2d44663e5c",
"shasum": ""
},
"require": {
"monolog/monolog": "~1.17",
"php": ">=7.0.0",
"unreal4u/telegram-api": "~2.1"
},
"require-dev": {
"phpmd/phpmd": "@stable",
"phpunit/phpunit": "@stable",
"squizlabs/php_codesniffer": "@stable"
},
"type": "library",
"autoload": {
"psr-4": {
"unreal4u\\": "src/unreal4u"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Camilo Sperberg",
"email": "me@unreal4u.com",
"homepage": "https://github.com/unreal4u/monolog-telegram/graphs/contributors"
}
],
"description": "Monolog handler to enable sending messages through Telegram",
"keywords": [
"api",
"monolog",
"monolog handler",
"telegram",
"telegram bot"
],
"time": "2016-12-14T00:25:05+00:00"
},
{
"name": "unreal4u/telegram-api",
"version": "v2.10.1",

View file

@ -12,13 +12,9 @@ class TelegramSendMessageCommand extends Command
/** @var MessageSender */
private $messenger;
/** @var int */
private $logChatId;
public function __construct(MessageSender $messenger, int $logChatId)
public function __construct(MessageSender $messenger)
{
$this->messenger = $messenger;
$this->logChatId = $logChatId;
parent::__construct();
}
@ -61,7 +57,7 @@ class TelegramSendMessageCommand extends Command
try {
$this->messenger->sendMessageToChat(
(int) $input->getOption('chat-id') ?: $this->logChatId,
(int) $input->getOption('chat-id'),
$message
);
} catch (\Exception $e) {