Laravel/Lumen Customizing Monolog For Channels

官方文档 https://laravel.com/docs/6.x/logging#creating-monolog-handler-channels 首先 新建一个 文件: 如官方文档所示,可以在 __invoke 方法里定制你的 logger,例如你想要 json 格式的日志的话: 更多设置: 输出的日志样本如下: { “message”: “Undefind method: \”asdasdad\””, “context”: {}, “level”: 400, “level_name”: “ERROR”, “channel”: “local”, “datetime”: “2020-05-11T17:05:07.231673+08:00”, “extra”: { …