Search code examples
monologstackify

Can I add a Processor to just one Monolog handler?


Can I add a Processor to just one Monolog handler? Or is there some other way I can alter a message that is only going out to one particular handler?

I want to add a text string to the end of $record['message']. I can do this now with a processor, but it affects all my handlers, which is no good for my situation.

Thanks.


Solution

  • Maybe this link can help you out: https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#customizing-the-log-format

    Also you can add a processor directly to the handler:

    $stackifyHandler->pushProcessor(<callable>);
    

    Adds a processor in the stack