示例#1
0
 /**
  * Implementation of the StupidHttp_Log::log() function.
  */
 public function log($message, $type = StupidHttp_Log::TYPE_INFO)
 {
     if ($type <= $this->level) {
         $prefix = '';
         if ($this->prefixAllMessages or $type != StupidHttp_Log::TYPE_INFO) {
             $prefix = '[' . StupidHttp_Log::messageTypeToString($type) . '] ';
         }
         $formattedMessage = $prefix . $message . PHP_EOL;
         if ($this->isBuffering) {
             $this->buffer .= $formattedMessage;
         } else {
             echo $formattedMessage;
         }
     }
 }