Esempio n. 1
0
 /**
  * Output given messages to the console.
  */
 public static function output($type, $message)
 {
     /**
      * Avoid repeating the same message multiple times in a row, e.g. repeated lines
      * and mode errors.
      */
     if ($message === self::$prevmessage) {
         return null;
     }
     self::$prevmessage = $message;
     $datetime = date('M d H:i:s');
     if (substr($datetime, 4, 1) === '0') {
         $datetime = substr_replace($datetime, ' ', 4, 1);
     }
     switch ($type) {
         case 'critical':
             /**
              * This type of message will always display and is followed up by the
              * termination of the program.
              */
             echo $datetime . ' [C] ' . $message . "\n";
             exit;
         case 'notice':
             if (self::$outputbits & 1) {
                 echo $datetime . ' [ ] ' . $message . "\n";
             }
             break;
         case 'debug':
             if (self::$outputbits & 2) {
                 echo $datetime . ' [D] ' . $message . "\n";
             }
             break;
     }
 }