如何在laravel 5,7中自定义日志记录

时间:2019-04-11 11:33:52

标签: php laravel-5.7

我阅读了“ laravel5.7”手册。并将自定义monolog类放入“ logging.php”的水龙头选项中,但不起作用。

这是针对“ laravel5.7”的,PHP 7.2.11-4

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single'],
    ],

    'single' => [
        'driver' => 'single',
        'tap' => [App\Log\CustomizeFormatter::class],
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
    ],
 ]

class CustomizeFormatter
{
    public function __invoke($logger)
    {
        $dateFormat = "Y n j, g:i a";
        $output = "%datetime% > %level_name% > %message% %context% extra%\n";
        $formatter = new LineFormatter($output, $dateFormat);
        foreach ($logger->getHandlers() as $handler) {
                $handler->setFormatter($formatter);
            }
    }
}

我希望我可以自定义日志记录并将多余的列写入日志。

1 个答案:

答案 0 :(得分:0)

.skew-overlay {
  z-index: 99;
  position: absolute;
  bottom: 0;
  right: -200px;
  width: 200px;
  height: 200px;
  background: #ff0;
  -webkit-transform: skewX(-45deg);
  transform: skewX(-45deg);
}