diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 32e064598e1..e4f26b282a9 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -80,6 +80,7 @@ allows you to log the messages in several ways easily. .. code-block:: xml + + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container + ->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor') + ->addArgument(new Reference('session')) + ->addTag('monolog.processor', array('method' => 'processRecord', 'handler' => 'main')); + +Registering Processors per Channel +---------------------------------- + +You can register a processor per channel using the ``channel`` option of +the ``monolog.processor`` tag: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + services: + monolog.processor.session_request: + class: Acme\MyBundle\SessionRequestProcessor + arguments: ["@session"] + tags: + - { name: monolog.processor, method: processRecord, channel: main } + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container + ->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor') + ->addArgument(new Reference('session')) + ->addTag('monolog.processor', array('method' => 'processRecord', 'channel' => 'main')); .. _Monolog: https://github.com/Seldaek/monolog