D.R.
D.R.

Reputation: 2858

Laravel 5.6. How to push Monolog processor

This issue is somewhat a "more broad version" of

Using Monolog WebProcessor with Laravel 5.6

I need to add Monolog Processor (which one is not so important for now) to my stack in Laravel.

How to do that?

Upvotes: 2

Views: 1801

Answers (1)

D.R.
D.R.

Reputation: 2858

This has solved the issue.

class PushUidProcessor
{
    /**
     * Pushed uid processor for adding a unique identifier into records.
     *
     * @param  \Illuminate\Log\Logger $logger
     *
     * @return void
     */
    public function __invoke(Logger $logger)
    {
        collect($logger->getHandlers())->each(function ($handler) {
            $handler->pushProcessor(new UidProcessor);
        });
    }
}

Upvotes: 3

Related Questions