Beispiel #1
0
 /**
  * getLogs
  *
  * Returns an array with log records
  *
  * @access public
  * @return array
  **/
 public function getLogs()
 {
     $adapter = $this->logger->getAdapter("test");
     $logs = array();
     foreach ($adapter->getRecords() as $record) {
         array_push($logs, $record["level"] . " " . $record["message"]);
     }
     return $logs;
 }
 /**
  * isLoggingForChannelAndLogLevel
  *
  * Returns true when:
  * - $level is equal to or above the minimum configured log level
  *
  * And
  *
  * - No channel has been set in $context
  * - No channels have been set in the adapter (meaning log all channels)
  * - The channel in $context is set as channel in this adapter
  *
  * @access public
  * @param  string   $level
  * @param  array    $context
  * @return boolean
  **/
 protected function isLoggingForChannelAndLogLevel($level, array $context)
 {
     $isLogging = true;
     if (!in_array($level, Logger::getLogLevels($this->getConfigurationValue("level")))) {
         $isLogging = false;
     }
     if ($isLogging === true && (!array_key_exists("channel", $context) || count($this->getChannels()) === 0 || in_array($context["channel"], $this->getChannels()))) {
         $isLogging = true;
     }
     return $isLogging;
 }