Specify formatter
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3019715. -->
Reported by: [legovaer](https://www.drupal.org/user/1327142)
>>>
<p>One of the powerful capabilities of monolog is to specify the formatter that should be used. This functionality is still lacking in this module.</p>
<p>I changed the MonologLoggerChannelFactory in a way that it allows users to add a formatter to their services.yml file:</p>
<pre>parameters:<br> http.response.debug_cacheability_headers: true<br> monolog.channel_handlers:<br> # Log to the syslog by default.<br> default: ['stream_handler']<br> # Send the php channel to web server's error log and the browser console:<br> php: ['error_log', 'browser_console']<br> # Ignore log entries of "content" channel.<br> content: ['null']<br> formatter: 'logstash'<br><br>services:<br> cache.backend.null:<br> class: Drupal\Core\Cache\NullBackendFactory<br> monolog.handler.stream_handler:<br> class: Monolog\Handler\StreamHandler<br> # Set alert as the minimum level (ignores emergency) and disable bubbling for this Handler<br> arguments: ['/app/logs/test.log']<br> monolog.formatter.logstash:<br> class: Monolog\Formatter\LogstashFormatter<br> arguments: ['test']</pre>
issue