39 public function format(array $record)
56 protected function formatArray(array $record, $nestingLevel = 0)
58 if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
59 foreach ($record as
$name => $value) {
60 if ($value instanceof \DateTime) {
62 } elseif ($value instanceof \Exception) {
64 } elseif (is_array($value)) {
66 } elseif (is_object($value)) {
79 $objectVars = get_object_vars($value);
82 return $this->
formatArray($objectVars, $nestingLevel);
87 $formattedException = array(
89 'message' => $exception->getMessage(),
90 'code' => $exception->getCode(),
91 'file' => $exception->getFile() .
':' . $exception->getLine(),
94 if ($this->exceptionTraceAsString ===
true) {
95 $formattedException[
'trace'] = $exception->getTraceAsString();
97 $formattedException[
'trace'] = $exception->getTrace();
100 return $this->
formatArray($formattedException, $nestingLevel);
103 protected function formatDate(\DateTime $value, $nestingLevel)
105 return new \MongoDate($value->getTimestamp());
An exception for terminatinating execution or to throw for unit testing.