Exemplo n.º 1
0
 /**
  * Logs with an arbitrary level.
  * This logs to PHP's error log.
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     if (!LogLevel::isValidValue($level)) {
         throw new \InvalidArgumentException('Invalid loge level: ' . $level);
     }
     $timestamp = time();
     $log = sprintf('[%s] %s %s', date('Y-m-d H:i:s', $timestamp), strtoupper($level), self::interpolate($message, $context));
     error_log($log);
 }
Exemplo n.º 2
0
 /**
  *
  * @param string $level
  * @param string $message
  */
 private function log($level, $message)
 {
     if (isset($this->logger) && LogLevel::isValidValue($level)) {
         $this->logger->{$level}($message);
     }
 }