37 public function format(array $record)
54 protected function formatArray(array $record, $nestingLevel = 0)
56 if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
57 foreach ($record as
$name => $value) {
58 if ($value instanceof \DateTime) {
60 } elseif ($value instanceof \Exception) {
62 } elseif (is_array($value)) {
64 } elseif (is_object($value)) {
77 $objectVars = get_object_vars($value);
78 $objectVars[
'class'] = get_class($value);
80 return $this->
formatArray($objectVars, $nestingLevel);
85 $formattedException = array(
86 'class' => get_class($exception),
87 'message' => $exception->getMessage(),
88 'code' => $exception->getCode(),
89 'file' => $exception->getFile() .
':' . $exception->getLine(),
92 if ($this->exceptionTraceAsString ===
true) {
93 $formattedException[
'trace'] = $exception->getTraceAsString();
95 $formattedException[
'trace'] = $exception->getTrace();
98 return $this->
formatArray($formattedException, $nestingLevel);
101 protected function formatDate(\DateTime $value, $nestingLevel)
103 return new \MongoDate($value->getTimestamp());
An exception for terminatinating execution or to throw for unit testing.