entries[] = array($severity, $line); $this->print_all('immediately final'); return; } if($args !== self::NO_ARGUMENTS) $line .= '; '. var_export($args, true); $this->entries[] = array($severity, $line); } function log_phperror($errno, $errstr, $errfile, $errline) { switch($errno) { case E_WARNING: $errno = self::WARN; break; case E_NOTICE: $errno = self::NOTICE; break; default: $errno = self::WARN; break; } $this->log("Error on line $errline in file $errfile:\n
".htmlspecialchars($errstr)."", $errno); /* Don't execute PHP internal error handler */ return true; } function php_shutdown() { if(!$this->is_empty()) { // we still have errors. print them! $this->print_all('final shutdown'); } } function is_empty() { return empty($this->entries); } function print_all($ul_classes='') { // causal printing function. Flushes entries afterwards! // if $ul_classes is given, will print a list around if($ul_classes) print " "; $this->entries = array(); // flush entries! } // convenience functions public function FATAL($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::FATAL, $args); } public function INFO($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::INFO, $args); } public function DEBUG($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::DEBUG, $args); } public function WARN($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::WARN, $args); } } // class