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
2019-11-13 10:58:42 +01:00
6 changed files with 59 additions and 23 deletions

View File

@@ -130,4 +130,22 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa
$this->handler->reset();
}
}
/**
* {@inheritdoc}
*/
public function setFormatter(FormatterInterface $formatter)
{
$this->handler->setFormatter($formatter);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->handler->getFormatter();
}
}

View File

@@ -217,8 +217,8 @@ class SlackRecord
$hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
return $hasSecondDimension || $hasNonNumericKeys
? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)
: Utils::jsonEncode($normalized, JSON_UNESCAPED_UNICODE);
? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|Utils::DEFAULT_JSON_FLAGS)
: Utils::jsonEncode($normalized, Utils::DEFAULT_JSON_FLAGS);
}
/**

View File

@@ -49,13 +49,17 @@ final class Utils
$encodeFlags = self::DEFAULT_JSON_FLAGS;
}
$json = json_encode($data, $encodeFlags);
if (false === $json) {
if ($ignoreErrors) {
if ($ignoreErrors) {
$json = @json_encode($data, $encodeFlags);
if (false === $json) {
return 'null';
}
return $json;
}
$json = json_encode($data, $encodeFlags);
if (false === $json) {
$json = self::handleJsonError(json_last_error(), $data);
}