1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

When newlines are allowed in LineFormatter, unpack json_encoded blobs containing newlines into multiline strings, fixes #752

This commit is contained in:
Jordi Boggiano
2016-09-25 18:22:52 +02:00
parent 96f4fd718f
commit bb61bfbe3b
2 changed files with 23 additions and 1 deletions

View File

@@ -130,7 +130,7 @@ class LineFormatter extends NormalizerFormatter
$str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
if ($this->includeStacktraces) {
$str .= "\n[stacktrace]\n".$e->getTraceAsString();
$str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n";
}
return $str;
@@ -152,6 +152,10 @@ class LineFormatter extends NormalizerFormatter
protected function replaceNewlines($str)
{
if ($this->allowInlineLineBreaks) {
if (0 === strpos($str, '{')) {
return str_replace(['\r', '\n'], ["\r", "\n"], $str);
}
return $str;
}