/** * Log a message. * * @param MessageInterface $message MessageInterface instance */ public function __invoke(MessageInterface $message) { $interpolatedMessage = $this->interpolate($message->getMessage(), $message->getContext()); $context = $message->getContext(); // Check for a \Exception in the context if (isset($context['exception']) && $context['exception'] instanceof \Exception) { $interpolatedMessage .= " " . (string) $context['exception']; unset($context['exception']); } $sql = "INSERT INTO {$this->options['table']} ({$this->options['column.datetime']}, {$this->options['column.level']}, {$this->options['column.message']}, {$this->options['column.context']}) VALUES (NOW(), ?, ?, ?)"; $sth = $this->connection->prepare($sql); $sth->execute([$message->getLevel(), $interpolatedMessage, json_encode($context)]); }
/** * Log a message. * * @param MessageInterface $message MessageInterface instance */ public function __invoke(MessageInterface $message) { file_put_contents($this->file, $this->format($message->getLevel(), $message->getMessage(), $message->getContext()), FILE_APPEND); }
public function __invoke(MessageInterface $message) { return $this->interpolate($message->getMessage(), $message->getContext()); }
public function __invoke(MessageInterface $message) { echo $message->getMessage(); }