I'm using monolog to log API requests. Some of those log messages include fairly large payloads. I would like to keep the general verbosity, but cut off all lines at 300 characters. Is it possible to configure monolog accordingly?
Asked
Active
Viewed 2,186 times
1 Answers
3
You can use a processor in order to do it (https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#adding-extra-data-in-the-records) :
$logger->pushProcessor(function ($record) {
$record['message'] = substr($record['message'],0,300);
return $record;
});

griotteau
- 1,772
- 12
- 15