mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-03 06:29:20 +00:00
new event handler
This commit is contained in:
36
resources/classes/event/handler/syslog.php
Normal file
36
resources/classes/event/handler/syslog.php
Normal file
@@ -0,0 +1,36 @@
|
||||
include_once('virtual.php');
|
||||
|
||||
class Syslog extends Event_Handler{
|
||||
|
||||
protected $ident;
|
||||
protected $option;
|
||||
protected $facility;
|
||||
protected $priority;
|
||||
function __construct($ident='fusionpbx', $option=(LOG_PID | LOG_PERROR), $facility=LOG_LOCAL0, $priority=LOG_INFO){
|
||||
$this->ident = $ident;
|
||||
$this->option = $option;
|
||||
$this->facility = $facility;
|
||||
$this->priority = $priority;
|
||||
|
||||
if ($_SESSION['event']['syslog']['enable'] <> 0){
|
||||
openlog($ident, $option, $facility);
|
||||
}
|
||||
}
|
||||
|
||||
function __destruct(){
|
||||
if ($_SESSION['event']['syslog']['enable'] <> 0){
|
||||
closelog();
|
||||
}
|
||||
}
|
||||
|
||||
public function log_event($event_type, $params){
|
||||
if ($_SESSION['event']['syslog']['enable'] <> 0){
|
||||
$log = '' ;
|
||||
foreach ($params as $k => $v) {
|
||||
$log .= "[$k]=[$v] ";
|
||||
}
|
||||
|
||||
syslog($priority, $log);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user