From d0d3e944eda7bd2975a4d2e06bb29f860499b24b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 10 Sep 2020 10:26:49 +0200 Subject: [PATCH] Extend LSlog_handler using LSlog_staticLoggerClass --- src/includes/class/class.LSlog_console.php | 2 +- src/includes/class/class.LSlog_email.php | 2 +- src/includes/class/class.LSlog_file.php | 2 +- src/includes/class/class.LSlog_handler.php | 10 ++++++---- src/includes/class/class.LSlog_syslog.php | 2 +- src/includes/class/class.LSlog_system.php | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/includes/class/class.LSlog_console.php b/src/includes/class/class.LSlog_console.php index c603843c..ca0d187e 100644 --- a/src/includes/class/class.LSlog_console.php +++ b/src/includes/class/class.LSlog_console.php @@ -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)); } /** diff --git a/src/includes/class/class.LSlog_email.php b/src/includes/class/class.LSlog_email.php index 89caa813..573395d1 100644 --- a/src/includes/class/class.LSlog_email.php +++ b/src/includes/class/class.LSlog_email.php @@ -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)); } /** diff --git a/src/includes/class/class.LSlog_file.php b/src/includes/class/class.LSlog_file.php index 5def018b..a2d44511 100644 --- a/src/includes/class/class.LSlog_file.php +++ b/src/includes/class/class.LSlog_file.php @@ -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)); } /** diff --git a/src/includes/class/class.LSlog_handler.php b/src/includes/class/class.LSlog_handler.php index 00b42299..61774697 100644 --- a/src/includes/class/class.LSlog_handler.php +++ b/src/includes/class/class.LSlog_handler.php @@ -20,12 +20,14 @@ ******************************************************************************/ +LSsession :: loadLSclass('LSlog_staticLoggerClass'); + /** * Default logging handler * * @author Benjamin Renard */ -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; } diff --git a/src/includes/class/class.LSlog_syslog.php b/src/includes/class/class.LSlog_syslog.php index 7790ac30..5f6f2b96 100644 --- a/src/includes/class/class.LSlog_syslog.php +++ b/src/includes/class/class.LSlog_syslog.php @@ -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)); } /** diff --git a/src/includes/class/class.LSlog_system.php b/src/includes/class/class.LSlog_system.php index 1eb0324a..918094bc 100644 --- a/src/includes/class/class.LSlog_system.php +++ b/src/includes/class/class.LSlog_system.php @@ -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)); } /**