Skip to content

Commit 7e3d791

Browse files
committed
[doc][skip ci] Add cookbook on how to change consume command logger.
1 parent ecb6980 commit 7e3d791

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to change consume command logger
2+
3+
By default `bin/console enqueue:consume` (or `bin/console enqueue:transport:consume`) command prints messages to output.
4+
The amount of info could be controlled by verbosity option (-v, -vv, -vvv).
5+
6+
In order to change the default logger used by a command you have to register a `LoggerExtension` just before the default one.
7+
The extension asks you for a logger service, so just pass the one you want to use.
8+
Here's how you can do it.
9+
10+
```yaml
11+
// config/services.yaml
12+
13+
services:
14+
app_logger_extension:
15+
class: 'Enqueue\Consumption\Extension\LoggerExtension'
16+
public: false
17+
arguments: ['@logger']
18+
tags:
19+
- { name: 'enqueue.consumption.extension', priority: 255 }
20+
21+
```
22+
23+
The logger extension with the highest priority will set its logger.
24+
25+
[back to index](../index.md)
26+
27+
28+

Diff for: docs/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
* [Development](#development)
5252
- [Contribution](contribution.md)
5353

54+
## Cookbook
55+
56+
* [Symfony](#symfony-cookbook)
57+
- [How to change consume command logger](cookbook/symfony/how-to-change-consume-command-logger.md)
58+
5459
# Blogs
5560

5661
* [Getting Started with RabbitMQ in PHP](https://blog.forma-pro.com/getting-started-with-rabbitmq-in-php-84d331e20a66)

0 commit comments

Comments
 (0)