3 private static $instance;
6 public static $errornames = array(
12 32 => 'E_CORE_WARNING',
13 64 => 'E_COMPILE_ERROR',
14 128 => 'E_COMPILE_WARNING',
15 256 => 'E_USER_ERROR',
16 512 => 'E_USER_WARNING',
17 1024 => 'E_USER_NOTICE',
19 4096 => 'E_RECOVERABLE_ERROR',
20 8192 => 'E_DEPRECATED',
21 16384 => 'E_USER_DEPRECATED',
24 function log_error($errno, $errstr, $file, $line, $context) {
25 if ($errno == E_NOTICE) return false;
28 return $this->adapter->log_error($errno, $errstr, $file, $line, $context);
33 function log($string, $context = "") {
35 return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context);
40 private function __clone() {
44 function __construct() {
45 switch (LOG_DESTINATION) {
47 $this->adapter = new Logger_SQL();
50 $this->adapter = new Logger_Syslog();
53 $this->adapter = new Logger_Stdout();
56 $this->adapter = false;
60 public static function get() {
61 if (self::$instance == null)
62 self::$instance = new self();
64 return self::$instance;