28        $this->assertEquals(
true, $formatter->isAppendingNewlines());
 
   31        $this->assertEquals(
false, $formatter->isAppendingNewlines());
 
   41        $this->assertEquals(json_encode($record).
"\n", $formatter->format($record));
 
   45        $this->assertEquals(json_encode($record), $formatter->format($record));
 
   59        $this->assertEquals(json_encode(
$records), $formatter->formatBatch(
$records));
 
   73        array_walk($expected, 
function (&$value, 
$key) {
 
   74            $value = json_encode($value);
 
   76        $this->assertEquals(implode(
"\n", $expected), $formatter->formatBatch(
$records));
 
   82        $exception = new \RuntimeException(
'Foo');
 
   93        $exception = new \RuntimeException(
'Foo', 0, 
new \LogicException(
'Wut?'));
 
   94        $formattedPrevException = $this->
formatException($exception->getPrevious());
 
   95        $formattedException = $this->
formatException($exception, $formattedPrevException);
 
  104        if (!class_exists(
'Error') || !is_subclass_of(
'Error', 
'Throwable')) {
 
  105            $this->markTestSkipped(
'Requires PHP >=7');
 
  109        $throwable = new \Error(
'Foo');
 
  126            '{"level_name":"CRITICAL","channel":"core","context":{"exception":'.$expected.
'},"datetime":null,"extra":[],"message":"foobar"}'.
"\n",
 
  140            'level_name' => 
'CRITICAL',
 
  142            'context' => array(
'exception' => $exception),
 
  145            'message' => 
'foobar',
 
  158        if (version_compare(PHP_VERSION, 
'5.4.0', 
'>=')) {
 
  159            $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
 
  161        $path = substr(json_encode($exception->getFile(), 
$options), 1, -1);
 
  162        return $path . 
':' . $exception->getLine();
 
  174        $formattedException =
 
  175            '{"class":"' . get_class($exception) .
 
  176            '","message":"' . $exception->getMessage() .
 
  177            '","code":' . $exception->getCode() .
 
  179            ($previous ? 
'","previous":' . $previous : 
'"') .
 
  181        return $formattedException;
 
  187        $largeArray = range(1, 1000);
 
  189        $res = $formatter->format(array(
 
  190            'level_name' => 
'CRITICAL',
 
  193            'context' => array($largeArray),
 
  194            'datetime' => 
new \DateTime,
 
  198        $this->assertCount(1000, 
$res[
'context'][0]);
 
  199        $this->assertArrayNotHasKey(
'...', 
$res[
'context'][0]);
 
  205        $largeArray = range(1, 2000);
 
  207        $res = $formatter->format(array(
 
  208            'level_name' => 
'CRITICAL',
 
  211            'context' => array($largeArray),
 
  212            'datetime' => 
new \DateTime,
 
  216        $this->assertCount(1001, 
$res[
'context'][0]);
 
  217        $this->assertEquals(
'Over 1000 items (2000 total), aborting normalization', 
$res[
'context'][0][
'...']);
 
An exception for terminatinating execution or to throw for unit testing.
const WARNING
Exceptional occurrences that are not errors.
const DEBUG
Detailed debug information.
getRecord($level=Logger::WARNING, $message='test', $context=array())
catch(Exception $e) $message
foreach($_POST as $key=> $value) $res