Merged in sentry_logging (pull request #22)

Telegram logging removed. JMS Serializer updated.
This commit is contained in:
Alexey Eschenko 2019-01-19 01:14:32 +00:00
commit 9798590f3e
7 changed files with 46 additions and 130 deletions

View file

@ -79,9 +79,6 @@ swiftmailer:
password: "%mailer_password%" password: "%mailer_password%"
spool: { type: memory } spool: { type: memory }
jms_serializer:
enable_short_alias: false
knp_markdown: knp_markdown:
parser: parser:
service: app.point.markdown_parser service: app.point.markdown_parser

View file

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

View file

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

View file

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

View file

@ -27,12 +27,11 @@
"sensio/framework-extra-bundle": "^5.0.0", "sensio/framework-extra-bundle": "^5.0.0",
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
"ob/highcharts-bundle": "^1.2", "ob/highcharts-bundle": "^1.2",
"jms/serializer-bundle": "^1.1", "jms/serializer-bundle": "^2",
"knplabs/knp-markdown-bundle": "^1.4", "knplabs/knp-markdown-bundle": "^1.4",
"knplabs/knp-paginator-bundle": "^2.5", "knplabs/knp-paginator-bundle": "^2.5",
"unreal4u/telegram-api": "^2.2", "unreal4u/telegram-api": "^2.2",
"csa/guzzle-bundle": "3.0.x-dev", "csa/guzzle-bundle": "^3",
"unreal4u/monolog-telegram": "^0.2.0",
"symfony/web-server-bundle": "^3.3", "symfony/web-server-bundle": "^3.3",
"sentry/sentry-symfony": "^2.2" "sentry/sentry-symfony": "^2.2"
}, },

135
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "25070b6017a4491a6e112ec681985169", "content-hash": "c50bcdcd4c9deacaba7bb6c8456d6ce1",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -64,16 +64,16 @@
}, },
{ {
"name": "csa/guzzle-bundle", "name": "csa/guzzle-bundle",
"version": "dev-master", "version": "v3.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/csarrazi/CsaGuzzleBundle.git", "url": "https://github.com/csarrazi/CsaGuzzleBundle.git",
"reference": "6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96" "reference": "7a69201bb5f1c60e11ca6a1e00f630ca0fe47806"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/csarrazi/CsaGuzzleBundle/zipball/6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96", "url": "https://api.github.com/repos/csarrazi/CsaGuzzleBundle/zipball/7a69201bb5f1c60e11ca6a1e00f630ca0fe47806",
"reference": "6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96", "reference": "7a69201bb5f1c60e11ca6a1e00f630ca0fe47806",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -82,19 +82,17 @@
"csa/guzzle-stopwatch-middleware": "^1.0.0", "csa/guzzle-stopwatch-middleware": "^1.0.0",
"guzzlehttp/guzzle": "^6.1", "guzzlehttp/guzzle": "^6.1",
"php": "^7.1", "php": "^7.1",
"symfony/dependency-injection": "^2.8 || ^3.0 || ^4.0", "symfony/dependency-injection": "^2.8|^3.0|^4.0",
"symfony/filesystem": "^2.8 || ^3.0 || ^4.0", "symfony/filesystem": "^2.8|^3.0|^4.0",
"symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0", "symfony/framework-bundle": "^2.8|^3.0|^4.0",
"twig/twig": "^1.34 || ^2.4" "twig/twig": "^1.34|^2.4"
}, },
"require-dev": { "require-dev": {
"doctrine/cache": "^1.1",
"namshi/cuzzle": "^2.0", "namshi/cuzzle": "^2.0",
"phpunit/phpunit": "^4.8", "phpunit/phpunit": "^7.0",
"psr/cache": "^1.0", "symfony/phpunit-bridge": "^2.8|^3.0|^4.0",
"symfony/phpunit-bridge": "^2.7|^3.0|^4.0", "symfony/web-profiler-bundle": "^2.8|^3.0|^4.0",
"symfony/stopwatch": "^2.7|^3.0|^4.0", "symfony/yaml": "^2.8|^3.0|^4.0"
"symfony/web-profiler-bundle": "^2.3|^3.0|^4.0"
}, },
"suggest": { "suggest": {
"doctrine/cache": "Allows caching of responses", "doctrine/cache": "Allows caching of responses",
@ -106,7 +104,7 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-2.x": "2.3-dev", "dev-2.x": "2.3-dev",
"dev-master": "3.0-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -125,7 +123,7 @@
} }
], ],
"description": "A bundle integrating GuzzleHttp >= 4.0", "description": "A bundle integrating GuzzleHttp >= 4.0",
"time": "2017-10-29T11:18:46+00:00" "time": "2018-06-06T07:53:05+00:00"
}, },
{ {
"name": "csa/guzzle-cache-middleware", "name": "csa/guzzle-cache-middleware",
@ -2012,60 +2010,62 @@
}, },
{ {
"name": "jms/serializer-bundle", "name": "jms/serializer-bundle",
"version": "1.5.0", "version": "2.4.3",
"target-dir": "JMS/SerializerBundle",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/JMSSerializerBundle.git", "url": "https://github.com/schmittjoh/JMSSerializerBundle.git",
"reference": "85ee039a2b7f89d77c403e33cee7b43a875c31e5" "reference": "e5231652ce24b8673b2ac70bc76b0cabaf35deea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/JMSSerializerBundle/zipball/85ee039a2b7f89d77c403e33cee7b43a875c31e5", "url": "https://api.github.com/repos/schmittjoh/JMSSerializerBundle/zipball/e5231652ce24b8673b2ac70bc76b0cabaf35deea",
"reference": "85ee039a2b7f89d77c403e33cee7b43a875c31e5", "reference": "e5231652ce24b8673b2ac70bc76b0cabaf35deea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"jms/serializer": "^1.7", "jms/serializer": "^1.10",
"php": ">=5.4.0", "php": "^5.4|^7.0",
"phpoption/phpoption": "^1.1.0", "phpoption/phpoption": "^1.1.0",
"symfony/framework-bundle": "~2.3|~3.0" "symfony/framework-bundle": "~2.3|~3.0|~4.0"
}, },
"require-dev": { "require-dev": {
"doctrine/doctrine-bundle": "*",
"doctrine/orm": "*", "doctrine/orm": "*",
"phpunit/phpunit": "^4.2|^5.0", "phpunit/phpunit": "^4.8.35|^5.4.3|^6.0",
"symfony/browser-kit": "*", "symfony/expression-language": "~2.6|~3.0|~4.0",
"symfony/class-loader": "*", "symfony/finder": "^2.3|^3.0|^4.0",
"symfony/css-selector": "*",
"symfony/expression-language": "~2.6|~3.0",
"symfony/finder": "*",
"symfony/form": "*", "symfony/form": "*",
"symfony/process": "*",
"symfony/stopwatch": "*", "symfony/stopwatch": "*",
"symfony/twig-bundle": "*", "symfony/twig-bundle": "*",
"symfony/validator": "*", "symfony/validator": "*",
"symfony/yaml": "*" "symfony/yaml": "*"
}, },
"suggest": { "suggest": {
"jms/di-extra-bundle": "Required to get lazy loading (de)serialization visitors, ~1.3" "jms/di-extra-bundle": "Required to get lazy loading (de)serialization visitors, ~1.3",
"symfony/finder": "Required for cache warmup, supported versions ^2.3|^3.0|^4.0"
}, },
"type": "symfony-bundle", "type": "symfony-bundle",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.5-dev" "dev-master": "2.4-dev"
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"JMS\\SerializerBundle": "" "JMS\\SerializerBundle\\": ""
} },
"exclude-from-classmap": [
"/Tests/"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"Apache-2.0" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
},
{ {
"name": "Johannes M. Schmitt", "name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com" "email": "schmittjoh@gmail.com"
@ -2080,7 +2080,7 @@
"serialization", "serialization",
"xml" "xml"
], ],
"time": "2017-05-10T10:17:17+00:00" "time": "2018-12-09T07:52:19+00:00"
}, },
{ {
"name": "knplabs/knp-components", "name": "knplabs/knp-components",
@ -4240,57 +4240,6 @@
"description": "Dummy logger that implements PSR-3 so that my own classes can work with a common base", "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" "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", "name": "unreal4u/telegram-api",
"version": "v2.10.1", "version": "v2.10.1",
@ -5903,9 +5852,7 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": [],
"csa/guzzle-bundle": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {

View file

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