Extend LSlog_handler using LSlog_staticLoggerClass

This commit is contained in:
Benjamin Renard 2020-09-10 10:26:49 +02:00
parent 988054bfc5
commit d0d3e944ed
6 changed files with 11 additions and 9 deletions

View file

@ -43,7 +43,7 @@ class LSlog_console extends LSlog_handler {
$this -> stdout = fopen('php://stdout', 'w');
$this -> stderr = fopen('php://stderr', 'w');
if ($this -> enabled)
LSlog :: log_trace("$this Enabled", get_class($this));
self :: log_trace("$this Enabled", get_class($this));
}
/**

View file

@ -44,7 +44,7 @@ class LSlog_email extends LSlog_handler {
parent :: __construct($config);
$this -> recipient = self :: getConfig('recipient');
if ($this -> enabled)
LSlog :: log_trace("$this Enabled", get_class($this));
self :: log_trace("$this Enabled", get_class($this));
}
/**

View file

@ -44,7 +44,7 @@ class LSlog_file extends LSlog_handler {
if (substr($this -> path, 0, 1) != '/')
$this -> path = LS_ROOT_DIR."/".$this -> path;
if ($this -> enabled)
LSlog :: log_trace("$this Enabled", get_class($this));
self :: log_trace("$this Enabled", get_class($this));
}
/**

View file

@ -20,12 +20,14 @@
******************************************************************************/
LSsession :: loadLSclass('LSlog_staticLoggerClass');
/**
* Default logging handler
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSlog_handler {
class LSlog_handler extends LSlog_staticLoggerClass {
// The handler configuration
protected $config;
@ -110,7 +112,7 @@ class LSlog_handler {
return $format;
}
// Unknown key, log warning
LSlog :: log_warning("$this -> __get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
self :: log_warning("__get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
}
/**
@ -151,10 +153,10 @@ class LSlog_handler {
**/
public function setLevel($level) {
if (!is_null($level) && !LSlog :: checkLevelExists($level)) {
LSlog :: error("Invalid log level '$level'");
self :: log_error("Invalid log level '$level'");
return false;
}
LSlog :: debug("Log handler ".get_called_class()." level set to ".(is_null($level)?'default':$level));
self :: log_debug("Log handler ".get_called_class()." level set to ".(is_null($level)?'default':$level));
$this -> level = $level;
}

View file

@ -60,7 +60,7 @@ class LSlog_syslog extends LSlog_handler {
parent :: __construct($config);
$this -> priority = static :: getConfig('priority');
if ($this -> enabled)
LSlog :: log_trace("$this Enabled", get_class($this));
self :: log_trace("$this Enabled", get_class($this));
}
/**

View file

@ -40,7 +40,7 @@ class LSlog_system extends LSlog_handler {
public function __construct($config) {
parent :: __construct($config);
if ($this -> enabled)
LSlog :: log_trace("$this Enabled", get_class($this));
self :: log_trace("$this Enabled", get_class($this));
}
/**