lundi 26 juin 2017

Laravel: multiple log providers using `configureMonologUsing()`?

I'm using configureMonologUsing() to add in two custom loggers. Doing the standard SOLID principal, I have two providers: ConsoleLoggerProvider and MailLogProvider.

Both of these have a register similar to:

public function register()
{
    app()->configureMonologUsing(function(\Monolog\Logger $monolog) {
        $monolog->pushHandler(new HandlerClass());
    });
}

However, I have noticed over logger will overwrite another logger... How do I stack these?

I've tried to use boot() as well, and that didn't work. I couldn't find any other way to add to the Monolog stack.

Preferable, I want to stack onto Laravel's built-in logger as well.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire