Skip to content

Commit 9e18808

Browse files
author
DKravtsov
committed
Improved bundle configuration for the latest Symfony framework.
1 parent b6b70cf commit 9e18808

File tree

5 files changed

+52
-89
lines changed

5 files changed

+52
-89
lines changed

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ COPY ./docker/general/do_we_need_xdebug.sh /tmp/
6363
COPY ./docker/dev/xdebug.ini /tmp/
6464
RUN chmod u+x /tmp/do_we_need_xdebug.sh && /tmp/do_we_need_xdebug.sh
6565

66-
# copy modified monolog config for testing easyLogBundle
67-
COPY ./docker/dev/monolog.yaml /tmp/
68-
6966
# install composer
7067
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
7168
RUN chmod +x /usr/bin/composer

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,27 @@ test-using-symfony-6:
8181
@make clean
8282
@make exec-bash cmd="composer create-project symfony/skeleton:'6.4.x' ."
8383
@make exec-bash cmd="composer require webapp --no-interaction"
84-
@make transfer-monolog-config
8584
@make install-bundle
8685
@make cache-clear-warmup
8786

8887
test-using-symfony-7:
8988
@make clean
9089
@make exec-bash cmd="composer create-project symfony/skeleton:'7.4.x' ."
9190
@make exec-bash cmd="composer require webapp --no-interaction"
92-
@make transfer-monolog-config
9391
@make install-bundle
9492
@make cache-clear-warmup
9593

9694
test-using-symfony-8:
9795
@make clean
9896
@make exec-bash cmd="composer create-project symfony/skeleton:'8.0.x' ."
9997
@make exec-bash cmd="composer require webapp --no-interaction"
100-
@make transfer-monolog-config
10198
@make install-bundle
10299
@make cache-clear-warmup
103100

104101
clean:
105102
@make exec-by-root cmd="find . -delete"
106103
@make exec-by-root cmd="chown -R www-data:www-data /var/www/html"
107104

108-
transfer-monolog-config:
109-
@make exec-bash cmd="mkdir -p /var/www/html/config/packages/dev && cp --force /tmp/monolog.yaml /var/www/html/config/packages/dev/"
110-
111105
install-bundle:
112106
@make exec-bash cmd="composer config extra.symfony.allow-contrib true"
113107
@make exec-bash cmd="composer require --dev systemsdk/easy-log-bundle:*"

docker/dev/monolog.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

readme.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,7 @@ $ composer remove easycorp/easy-log-handler
145145
```
146146
Note: Please remove configuration files `config/packages/easy_log_handler.yaml`, `config/packages/dev/easy_log_handler.yaml`, `config/packages/test/easy_log_handler.yaml`, etc...
147147

148-
2. Edit your `config/packages/dev/monolog.yaml` and `config/packages/test/monolog.yaml` and put next configuration:
149-
```yaml
150-
monolog:
151-
handlers:
152-
buffered:
153-
type: buffer
154-
handler: easylog
155-
level: debug
156-
channels: ['!event']
157-
easylog:
158-
type: service
159-
id: easy_log.handler
160-
```
161-
In the above configuration, the `buffered` handler saves all log messages and then passes them to the EasyLog bundle, which processes all messages at once and writes the result in the log file.
162-
Use the `buffered` handler to configure the channels logged/excluded and the level of the messages being logged.
163-
164-
3. Allow Flex to use contrib recipes and install next symfony bundle:
148+
2. Allow Flex to use contrib recipes and install the next symfony bundle:
165149
```bash
166150
$ composer config extra.symfony.allow-contrib true
167151
$ composer require --dev systemsdk/easy-log-bundle:*
@@ -170,13 +154,31 @@ $ composer require --dev systemsdk/easy-log-bundle:*
170154
Configuration and Usage
171155
-----------------------
172156

173-
You can change default configuration in your application by editing next config file:
157+
You can change the default configuration in your application by editing the next config file:
174158

175159
```yaml
176-
# config/packages/dev/systemsdk_easy_log.yaml
177-
easy_log:
178-
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
179-
max_line_length: 120
180-
prefix_length: 2
181-
ignored_routes: ['_wdt', '_profiler']
160+
# config/packages/systemsdk_easy_log.yaml
161+
when@dev:
162+
monolog:
163+
handlers:
164+
buffered:
165+
type: buffer
166+
handler: easylog
167+
level: debug
168+
channels: [ '!event' ]
169+
easylog:
170+
type: service
171+
id: easy_log.handler
172+
easy_log:
173+
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
174+
max_line_length: 120
175+
prefix_length: 4
176+
ignored_routes: [ '_wdt', '_profiler' ]
177+
178+
when@test:
179+
easy_log:
180+
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
181+
max_line_length: 120
182+
prefix_length: 4
183+
ignored_routes: [ '_wdt', '_profiler' ]
182184
```

src/Resources/doc/index.rst

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,7 @@ Installation
2727
Note: Please remove configuration files ``config/packages/easy_log_handler.yaml``,
2828
``config/packages/dev/easy_log_handler.yaml``, ``config/packages/test/easy_log_handler.yaml``, etc...
2929

30-
2. Edit your ``config/packages/dev/monolog.yaml`` and ``config/packages/test/monolog.yaml`` and put next configuration:
31-
32-
.. configuration-block::
33-
34-
.. code-block:: yaml
35-
36-
monolog:
37-
handlers:
38-
buffered:
39-
type: buffer
40-
handler: easylog
41-
level: debug
42-
channels: ['!event']
43-
easylog:
44-
type: service
45-
id: easy_log.handler
46-
47-
In the above configuration, the ``buffered`` handler saves all log messages and then passes them to the EasyLog bundle,
48-
which processes all messages at once and writes the result in the log file.
49-
Use the ``buffered`` handler to configure the channels logged/excluded and the level of the messages being logged.
50-
51-
3. Allow Flex to use contrib recipes and install next symfony bundle:
30+
2. Allow Flex to use contrib recipes and install the next symfony bundle:
5231

5332
.. code-block:: bash
5433
$ composer config extra.symfony.allow-contrib true
@@ -58,17 +37,35 @@ Use the ``buffered`` handler to configure the channels logged/excluded and the l
5837
Configuration and Usage
5938
-----------------------
6039

61-
You can change default configuration in your application by editing next config file:
40+
You can change the default configuration in your application by editing the next config file:
6241

6342
.. configuration-block::
6443

6544
.. code-block:: yaml
6645
67-
# config/packages/dev/systemsdk_easy_log.yaml
68-
easy_log:
69-
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
70-
max_line_length: 120
71-
prefix_length: 2
72-
ignored_routes: ['_wdt', '_profiler']
46+
# config/packages/systemsdk_easy_log.yaml
47+
when@dev:
48+
monolog:
49+
handlers:
50+
buffered:
51+
type: buffer
52+
handler: easylog
53+
level: debug
54+
channels: [ '!event' ]
55+
easylog:
56+
type: service
57+
id: easy_log.handler
58+
easy_log:
59+
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
60+
max_line_length: 120
61+
prefix_length: 4
62+
ignored_routes: [ '_wdt', '_profiler' ]
63+
64+
when@test:
65+
easy_log:
66+
log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
67+
max_line_length: 120
68+
prefix_length: 4
69+
ignored_routes: [ '_wdt', '_profiler' ]
7370
7471
.. _`easycorp/easy-log-handler`: https://github.com/EasyCorp/easy-log-handler

0 commit comments

Comments
 (0)