jeudi 14 février 2019

Laravel only write logs of a given level

I'm using the Cache facade to write logs this way: Cache::debug("...."), Cache::error("...") ... and was wondering if there is a way to instruct the application to ignore writing all levels except Error when on a given environment: Prod.

Example: without changing my code, all error, info & debug gets written to logs in development environment but only error is written when on production.

I tried creating a LogServiceProvider to somehow get the type of the error then do my checks but Laravel says I can't use the name LogServiceProvider because it's already used. I also tried to handle this inside App\Exceptions\Handler but this class is never called on writing logs, only exceptions.

Any idea how that might be achieved?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire