Cleanup style
This commit is contained in:
@ -37,7 +37,6 @@ class Monolog extends Parser
|
||||
"\s(?:\{|\[)(?<extra>.*)(?:\}|\])"
|
||||
];
|
||||
$regex = implode('', $regex);
|
||||
//$regex = "/\[(?P<date>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}(?:\+|-)\d{2}:\d{2})\]\s(?<channel>\w*)\.(?<severity>\w*):\s(?<message>.*)\s(?:\[|\{)(?<context>.*)(?:\]|\})\s(?:\{|\[)(?<extra>.*)(?:\}|\])/";
|
||||
try {
|
||||
\Safe\preg_match("/{$regex}/", $content, $matches);
|
||||
} catch (\Exception $e) {
|
||||
@ -66,11 +65,15 @@ class Monolog extends Parser
|
||||
$log->setStack($lines);
|
||||
}
|
||||
$log->setMessage($message);
|
||||
$log->setContext($matches['context']);
|
||||
if (isset($matches['extra'])) {
|
||||
if ($matches['context'] !== '') {
|
||||
$log->setContext("{{$matches['context']}}");
|
||||
}
|
||||
if (isset($matches['extra']) and $matches['extra'] !== '') {
|
||||
$extra['extra'] = "{{$matches['extra']}}";
|
||||
}
|
||||
$log->setExtra(\Safe\json_encode($extra, JSON_UNESCAPED_SLASHES));
|
||||
if (count($extra) > 0) {
|
||||
$log->setExtra(\Safe\json_encode($extra, JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
} catch (\Error $e) {
|
||||
\Safe\error_log($e . PHP_EOL, 3, '/logs/debug.log');
|
||||
\Safe\error_log(var_export($matches, true) . PHP_EOL, 3, '/logs/debug.log');
|
||||
|
Reference in New Issue
Block a user