Create monolog channel Symfony
https://symfony.com/doc/current/logging/channels_handlers.html
php bin/console debug:container monolog
OR
docker/ctrl exec "bin/console debug:container monolog"
Пример конфига с новым каналом colors:
monolog:
channels: ['colors']
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event", "!doctrine"]
doctrine:
type: stream
path: "%kernel.logs_dir%/doctrine.log"
channels: [doctrine]
colors:
type: stream
path: "%kernel.logs_dir%/colors.log"
channels: [colors]
Потом привязываем сервис лога для каждого класса отдельно в services.yaml:
App\Components\Modules\Capsules\SelectionByColors\SelectionByColorsService:
arguments:
$logger: '@monolog.logger.colors'
Last updated
Was this helpful?