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');
84 'level_name' =>
'CRITICAL',
86 'context' =>
array(
'exception' => $exception),
89 'message' =>
'foobar',
92 if (version_compare(PHP_VERSION,
'5.4.0',
'>=')) {
93 $path = substr(json_encode($exception->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
95 $path = substr(json_encode($exception->getFile()), 1, -1);
97 $this->assertEquals(
'{"level_name":"CRITICAL","channel":"core","context":{"exception":{"class":"RuntimeException","message":"'.$exception->getMessage().
'","code":'.$exception->getCode().
',"file":"'.
$path.
':'.$exception->getLine().
'"}},"datetime":'.json_encode(
new \
DateTime()).
',"extra":[],"message":"foobar"}'.
"\n",
$message);
103 $exception = new \RuntimeException(
'Foo', 0,
new \
LogicException(
'Wut?'));
105 'level_name' =>
'CRITICAL',
107 'context' =>
array(
'exception' => $exception),
110 'message' =>
'foobar',
113 if (version_compare(PHP_VERSION,
'5.4.0',
'>=')) {
114 $pathPrevious = substr(json_encode($exception->getPrevious()->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
115 $pathException = substr(json_encode($exception->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
117 $pathPrevious = substr(json_encode($exception->getPrevious()->getFile()), 1, -1);
118 $pathException = substr(json_encode($exception->getFile()), 1, -1);
120 $this->assertEquals(
'{"level_name":"CRITICAL","channel":"core","context":{"exception":{"class":"RuntimeException","message":"'.$exception->getMessage().
'","code":'.$exception->getCode().
',"file":"'.$pathException.
':'.$exception->getLine().
'","previous":{"class":"LogicException","message":"'.$exception->getPrevious()->getMessage().
'","code":'.$exception->getPrevious()->getCode().
',"file":"'.$pathPrevious.
':'.$exception->getPrevious()->getLine().
'"}}},"datetime":'.json_encode(
new \
DateTime()).
',"extra":[],"message":"foobar"}'.
"\n",
$message);
const DEBUG
Detailed debug information.
getRecord($level=Logger::WARNING, $message='test', $context=array())
catch(Exception $e) $message
const WARNING
Exceptional occurrences that are not errors.
Create styles array
The data for the language used.