init(); } return Logger::$instance; } function __construct() { // check configuration data $config = Config::getInstance(); $this->facility = $config->getConfig("Syslog::facility", $this->facility); $this->default_prio = $config->getConfig("Syslog::default_prio", $this->default_prio); $this->process_name = $config->getConfig("Syslog::process_name", $this->process_name); openlog($this->process_name, $this->default_prio, $this->facility); } function stripComponent( $comp ) { $items = explode("/", $comp); return end($items); } function log( $comp, $string , $prio=null) { $curr_prio = $this->default_prio; if ($prio) $curr_prio = $prio; syslog($this->facility | $curr_prio, $this->stripComponent($comp)." : $string"); } function logException( $comp, Exception $e ) { syslog($this->facility | LOG_ALERT, "Exception in $comp"); syslog($this->facility | LOG_ALERT, $e->getMessage()); syslog($this->facility | LOG_ALERT, $e->getTraceAsString()); } } ?>