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%"
spool: { type: memory }
jms_serializer:
enable_short_alias: false
knp_markdown:
parser:
service: app.point.markdown_parser

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

@ -27,12 +27,11 @@
"sensio/framework-extra-bundle": "^5.0.0",
"incenteev/composer-parameter-handler": "^2.0",
"ob/highcharts-bundle": "^1.2",
"jms/serializer-bundle": "^1.1",
"jms/serializer-bundle": "^2",
"knplabs/knp-markdown-bundle": "^1.4",
"knplabs/knp-paginator-bundle": "^2.5",
"unreal4u/telegram-api": "^2.2",
"csa/guzzle-bundle": "3.0.x-dev",
"unreal4u/monolog-telegram": "^0.2.0",
"csa/guzzle-bundle": "^3",
"symfony/web-server-bundle": "^3.3",
"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",
"This file is @generated automatically"
],
"content-hash": "25070b6017a4491a6e112ec681985169",
"content-hash": "c50bcdcd4c9deacaba7bb6c8456d6ce1",
"packages": [
{
"name": "composer/ca-bundle",
@ -64,16 +64,16 @@
},
{
"name": "csa/guzzle-bundle",
"version": "dev-master",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/csarrazi/CsaGuzzleBundle.git",
"reference": "6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96"
"reference": "7a69201bb5f1c60e11ca6a1e00f630ca0fe47806"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/csarrazi/CsaGuzzleBundle/zipball/6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96",
"reference": "6b10e6f318ea6a20fa32cfcda471bd0bbebcdb96",
"url": "https://api.github.com/repos/csarrazi/CsaGuzzleBundle/zipball/7a69201bb5f1c60e11ca6a1e00f630ca0fe47806",
"reference": "7a69201bb5f1c60e11ca6a1e00f630ca0fe47806",
"shasum": ""
},
"require": {
@ -82,19 +82,17 @@
"csa/guzzle-stopwatch-middleware": "^1.0.0",
"guzzlehttp/guzzle": "^6.1",
"php": "^7.1",
"symfony/dependency-injection": "^2.8 || ^3.0 || ^4.0",
"symfony/filesystem": "^2.8 || ^3.0 || ^4.0",
"symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0",
"twig/twig": "^1.34 || ^2.4"
"symfony/dependency-injection": "^2.8|^3.0|^4.0",
"symfony/filesystem": "^2.8|^3.0|^4.0",
"symfony/framework-bundle": "^2.8|^3.0|^4.0",
"twig/twig": "^1.34|^2.4"
},
"require-dev": {
"doctrine/cache": "^1.1",
"namshi/cuzzle": "^2.0",
"phpunit/phpunit": "^4.8",
"psr/cache": "^1.0",
"symfony/phpunit-bridge": "^2.7|^3.0|^4.0",
"symfony/stopwatch": "^2.7|^3.0|^4.0",
"symfony/web-profiler-bundle": "^2.3|^3.0|^4.0"
"phpunit/phpunit": "^7.0",
"symfony/phpunit-bridge": "^2.8|^3.0|^4.0",
"symfony/web-profiler-bundle": "^2.8|^3.0|^4.0",
"symfony/yaml": "^2.8|^3.0|^4.0"
},
"suggest": {
"doctrine/cache": "Allows caching of responses",
@ -106,7 +104,7 @@
"extra": {
"branch-alias": {
"dev-2.x": "2.3-dev",
"dev-master": "3.0-dev"
"dev-master": "3.1-dev"
}
},
"autoload": {
@ -125,7 +123,7 @@
}
],
"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",
@ -2012,60 +2010,62 @@
},
{
"name": "jms/serializer-bundle",
"version": "1.5.0",
"target-dir": "JMS/SerializerBundle",
"version": "2.4.3",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/JMSSerializerBundle.git",
"reference": "85ee039a2b7f89d77c403e33cee7b43a875c31e5"
"reference": "e5231652ce24b8673b2ac70bc76b0cabaf35deea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/JMSSerializerBundle/zipball/85ee039a2b7f89d77c403e33cee7b43a875c31e5",
"reference": "85ee039a2b7f89d77c403e33cee7b43a875c31e5",
"url": "https://api.github.com/repos/schmittjoh/JMSSerializerBundle/zipball/e5231652ce24b8673b2ac70bc76b0cabaf35deea",
"reference": "e5231652ce24b8673b2ac70bc76b0cabaf35deea",
"shasum": ""
},
"require": {
"jms/serializer": "^1.7",
"php": ">=5.4.0",
"jms/serializer": "^1.10",
"php": "^5.4|^7.0",
"phpoption/phpoption": "^1.1.0",
"symfony/framework-bundle": "~2.3|~3.0"
"symfony/framework-bundle": "~2.3|~3.0|~4.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "*",
"doctrine/orm": "*",
"phpunit/phpunit": "^4.2|^5.0",
"symfony/browser-kit": "*",
"symfony/class-loader": "*",
"symfony/css-selector": "*",
"symfony/expression-language": "~2.6|~3.0",
"symfony/finder": "*",
"phpunit/phpunit": "^4.8.35|^5.4.3|^6.0",
"symfony/expression-language": "~2.6|~3.0|~4.0",
"symfony/finder": "^2.3|^3.0|^4.0",
"symfony/form": "*",
"symfony/process": "*",
"symfony/stopwatch": "*",
"symfony/twig-bundle": "*",
"symfony/validator": "*",
"symfony/yaml": "*"
},
"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",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-0": {
"JMS\\SerializerBundle": ""
}
"psr-4": {
"JMS\\SerializerBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
"MIT"
],
"authors": [
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
},
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
@ -2080,7 +2080,7 @@
"serialization",
"xml"
],
"time": "2017-05-10T10:17:17+00:00"
"time": "2018-12-09T07:52:19+00:00"
},
{
"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",
"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",
@ -5903,9 +5852,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"csa/guzzle-bundle": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

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) {