Example #1
0
 /**
  * @param string $level
  * @param string $message
  * @param array $context
  */
 public function log($level, $message, array $context = array())
 {
     $max = $this->levelOrder($this->getFilterLevel());
     $ord = $this->levelOrder($level);
     if ($ord <= $max) {
         $params = new Param\Node($context);
         $prefix = "[{$level}] ";
         $suffix = $this->type == self::T_FILE ? "\n" : "";
         $output = $prefix . $params->render($message) . $suffix;
         error_log($output, $this->type, $this->destination);
     }
 }
Example #2
0
 /**
  * Logs a message
  * @param type $level
  * @param type $message
  * @param array $context
  * @return void
  */
 public function log($level, $message, array $context = array())
 {
     $target = $this->getTargetFile();
     $max = $this->levelOrder($this->getFilterLevel());
     $order = $this->levelOrder($level);
     if ($target && $order <= $max) {
         $params = new Param\Node($context);
         $timestamp = $this->getTimestamp();
         $resolved = $params->render($message);
         $output = "[{$timestamp}] [{$level}] {$resolved}\n";
         $target->fwrite($output);
     }
 }
Example #3
0
 /**
  * @param string $level
  * @param string $message
  * @param array $context
  */
 public function log($level, $message, array $context = array())
 {
     $logger = $this->getLogger();
     if ($logger) {
         $logger->log($level, $message, $context);
     } else {
         $params = new Param($context);
         $message = $params->render($message);
         error_log("{$level}: {$message}");
     }
 }
Example #4
0
 public function testResolve()
 {
     $model = new DataModel();
     $node = new Node(['dynamic' => $model]);
     $out = $node->render('{{&dynamic.ping}}');
     $this->assertEquals(['ping'], Buffer::extract());
     $this->assertEquals('NULL', $out);
 }