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

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-03-01 17:15:43 +00:00
19 changed files with 634 additions and 44 deletions

View File

@@ -11,8 +11,6 @@
namespace Monolog\Formatter;
use Exception;
/**
* Formats incoming records into a one-line string
*
@@ -78,6 +76,13 @@ class LineFormatter extends NormalizerFormatter
}
}
foreach ($vars['context'] as $var => $val) {
if (false !== strpos($output, '%context.'.$var.'%')) {
$output = str_replace('%context.'.$var.'%', $this->stringify($val), $output);
unset($vars['context'][$var]);
}
}
if ($this->ignoreEmptyContextAndExtra) {
if (empty($vars['context'])) {
unset($vars['context']);
@@ -114,8 +119,13 @@ class LineFormatter extends NormalizerFormatter
return $this->replaceNewlines($this->convertToString($value));
}
protected function normalizeException(Exception $e)
protected function normalizeException($e)
{
// TODO 2.0 only check for Throwable
if (!$e instanceof \Exception && !$e instanceof \Throwable) {
throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
}
$previousText = '';
if ($previous = $e->getPrevious()) {
do {