示例#1
0
文件: Logger.php 项目: rask/wplog
 /**
  * Logs with an arbitrary level.
  *
  * @since 0.1.0
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @param \Wplog\Events\Event The event being logged.
  *
  * @return Boolean
  */
 public function log($level, $message, array $context = array(), Event $event = null) : bool
 {
     $message = $this->parseContext($message, $context);
     $inserted = $this->wpdb->insert($this->wpdb->prefix . 'wplog', ['uuid' => Uuid::pack($event->getUuid()), 'timestamp' => $event->getTimestamp(), 'severity' => $level, 'event_type' => $event->getType(), 'body' => $message, 'user_id' => $event->getUserId()], ['%s', '%s', '%s', '%s', '%s', '%d']);
     return $inserted === 1;
 }