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

Check for json dependency, fixes #378

This commit is contained in:
Jordi Boggiano
2014-06-20 16:09:34 +02:00
parent 25b16e8019
commit 0951050a1e
2 changed files with 15 additions and 0 deletions

View File

@@ -30,6 +30,9 @@ class NormalizerFormatter implements FormatterInterface
public function __construct($dateFormat = null) public function __construct($dateFormat = null)
{ {
$this->dateFormat = $dateFormat ?: static::SIMPLE_DATE; $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE;
if (!function_exists('json_encode')) {
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter');
}
} }
/** /**

View File

@@ -50,6 +50,18 @@ class ChromePHPHandler extends AbstractProcessingHandler
protected static $sendHeaders = true; protected static $sendHeaders = true;
/**
* @param integer $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/
public function __construct($level = Logger::DEBUG, $bubble = true)
{
parent::__construct($level, $bubble);
if (!function_exists('json_encode')) {
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler');
}
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */