From 5b687fcca759eb4ab751d78f116f3a239b5f28d2 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 19 May 2021 07:48:29 +0000 Subject: [PATCH 1/2] Improve logging configuration --- README.md | 16 ++++------------ src/Handler/EmbeddedShortcodeHandler.php | 2 +- src/Resources/config/shortcodes.xml | 2 ++ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2939055..8ccf8c4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ comment: In analogy to living style guides, this bundle also provides an optional shortcode guide. This guide can be used for automated testing of your shortcodes as well. - ## Installation As usual, install via [composer](https://getcomposer.org/) and register the bundle in your application: @@ -55,7 +54,6 @@ public function registerBundles() } ``` - ## Usage ### Defining your own shortcodes @@ -161,7 +159,6 @@ And finally a twig template like this: ``` - ### Activating the Shortcode Guide The optional shortcode guide is a controller providing an overview page of the configured shortcodes and a detail page @@ -218,7 +215,6 @@ Finally, enrich your shortcode tags with description and example attributes for With the route prefix defined as above, call ```/shortcodes/``` to get the list of shortcodes and follow the links to the detail pages. - ### Configuration In most cases, the default values should work fine. But you might want to configure something else, e.g. if the default @@ -294,7 +290,6 @@ final class ImageTest extends ShortcodeTest } ``` - ## Logging When something goes wrong with the resolving of a shortcode, maybe you not only want to know which shortcode with @@ -303,9 +298,7 @@ that embedded the shortcode. This is tricky is you embed your shortcode controllers via ESI, as the ESI subrequest is in Symfony terms a master request, preventing you from getting your answer from RequestStack::getMasterRequest(). Hence, the -`EmbedShortcodeHandler` logs with the default monolog handler which controller it will call to resolve the shortcode. -You can overwrite the `EmbedShortcodeHandler`'s logger, e.g. if you want to change the channel, in the service -definition of your shortcode: +`EmbedShortcodeHandler` logs this information in the `shortcode` channel. ```xml @@ -323,12 +316,11 @@ definition of your shortcode: ``` - ## Credits, Copyright and License This bundle was started at webfactory GmbH, Bonn. -- -- +- +- -Copyright 2018 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE). +Copyright 2018-2021 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE). diff --git a/src/Handler/EmbeddedShortcodeHandler.php b/src/Handler/EmbeddedShortcodeHandler.php index 8e0c8ea..8ba3a59 100644 --- a/src/Handler/EmbeddedShortcodeHandler.php +++ b/src/Handler/EmbeddedShortcodeHandler.php @@ -56,7 +56,7 @@ public function __construct( */ public function __invoke(ShortcodeInterface $shortcode) { - $this->logger->notice( + $this->logger->info( 'Request {controllerName} with parameters {parameters} and renderer {renderer} to resolve shortcode {shortcode}, triggered by a request to {url}.', [ 'controllerName' => $this->controllerName, diff --git a/src/Resources/config/shortcodes.xml b/src/Resources/config/shortcodes.xml index 85fcfe5..1d17982 100644 --- a/src/Resources/config/shortcodes.xml +++ b/src/Resources/config/shortcodes.xml @@ -42,6 +42,7 @@ esi + @@ -54,6 +55,7 @@ inline + From 2904e1ec1b1305aa8a0626fb1f1e56de366bcd3d Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 19 May 2021 07:56:57 +0000 Subject: [PATCH 2/2] Add a CHANGELOG --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0b63f56 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased 2.0] + +### Changed + +- Logging will now by default be directed to the `shortcode` channel, + instead of the `app` channel used previously. +- Slightly reduced the logging level in `EmbeddedShortcodeHandler`.