mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Optimize removal of leftover extra/context placeholders, refs #866
This commit is contained in:
@@ -76,7 +76,6 @@ class LineFormatter extends NormalizerFormatter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = preg_replace('/%extra\..+?%/', '', $output);
|
|
||||||
|
|
||||||
foreach ($vars['context'] as $var => $val) {
|
foreach ($vars['context'] as $var => $val) {
|
||||||
if (false !== strpos($output, '%context.'.$var.'%')) {
|
if (false !== strpos($output, '%context.'.$var.'%')) {
|
||||||
@@ -85,8 +84,6 @@ class LineFormatter extends NormalizerFormatter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = preg_replace('/%context\..+?%/', '', $output);
|
|
||||||
|
|
||||||
if ($this->ignoreEmptyContextAndExtra) {
|
if ($this->ignoreEmptyContextAndExtra) {
|
||||||
if (empty($vars['context'])) {
|
if (empty($vars['context'])) {
|
||||||
unset($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;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user