mercredi 22 août 2018

Add custom data to laravel log

I want for a certain Laravel Job class to change the behaviour of the logging system. This is how my logs look right now:

[2018-08-22 08:31:24] production.INFO: [do-harvester-job]
[template: 598 - theme: 2592]Doing tasks

This is achieved by the following code:

\Log::info("{$this->harvester_job->log_prefix()}Doing tasks");

The problem is that I have a lot of log calls like this one and it gets cumbersome to always add the call to the log_prefix method.

Is there any way of prepending that info to the log without having to concatenate it inside the log call?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire