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

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2019-11-12 21:50:28 +01:00
19 changed files with 262 additions and 210 deletions

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler\Slack;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Formatter\FormatterInterface;
@@ -211,14 +212,13 @@ class SlackRecord
public function stringify(array $fields): string
{
$normalized = $this->normalizerFormatter->format($fields);
$prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
$hasSecondDimension = count(array_filter($normalized, 'is_array'));
$hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
return $hasSecondDimension || $hasNonNumericKeys
? json_encode($normalized, $prettyPrintFlag|JSON_UNESCAPED_UNICODE)
: json_encode($normalized, JSON_UNESCAPED_UNICODE);
? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)
: Utils::jsonEncode($normalized, JSON_UNESCAPED_UNICODE);
}
/**