1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 04:37:38 +02:00

Optimize removal of leftover extra/context placeholders, refs #866

This commit is contained in:
Jordi Boggiano
2016-11-13 20:17:30 +01:00
parent 79bf752d27
commit cc8a013611

View File

@@ -76,7 +76,6 @@ class LineFormatter extends NormalizerFormatter
}
}
$output = preg_replace('/%extra\..+?%/', '', $output);
foreach ($vars['context'] as $var => $val) {
if (false !== strpos($output, '%context.'.$var.'%')) {
@@ -85,8 +84,6 @@ class LineFormatter extends NormalizerFormatter
}
}
$output = preg_replace('/%context\..+?%/', '', $output);
if ($this->ignoreEmptyContextAndExtra) {
if (empty($vars['context'])) {
unset($vars['context']);
@@ -105,6 +102,11 @@ class LineFormatter extends NormalizerFormatter
}
}
// remove leftover %extra.xxx% and %context.xxx% if any
if (false !== strpos($output, '%')) {
$output = preg_replace('/%(?:extra|context)\..+?%/', '', $output);
}
return $output;
}