I know I can extend it as follows:
class MyLog extends Logs {
...
}
But, I don't want to do this as I have a plethora of Log::info()
in my project in different places.
Can I extend Log::info()
without making a new class MyLog?
I know I can extend it as follows:
class MyLog extends Logs {
...
}
But, I don't want to do this as I have a plethora of Log::info()
in my project in different places.
Can I extend Log::info()
without making a new class MyLog?
Laravel is using Monolog for logging which you can add processors to that can manipulate the record
before it gets sent to the different handlers for logging.
For now in the boot
method of a Service Provider you could try:
\Log::pushProcessor(function ($record) {
/*
record array contains keys:
message, context, level, level_name, channel, datetime, extra
*/
// do what you need to return your filtered record
return $record;
});