diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Driver.php b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Driver.php index 725071790..04da9da03 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Driver.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Driver.php @@ -100,6 +100,7 @@ abstract class Driver $this->aCache = array(); $this->aPrefixes = array( + \MailSo\Log\Enumerations\Type::DEBUG => '[DEBUG]', \MailSo\Log\Enumerations\Type::INFO => '[DATA]', \MailSo\Log\Enumerations\Type::SECURE => '[SECURE]', \MailSo\Log\Enumerations\Type::NOTE => '[NOTE]', @@ -152,12 +153,7 @@ abstract class Driver public function WriteOnTimeoutOnly(int $iTimeout) : self { - $this->iWriteOnTimeoutOnly = (int) $iTimeout; - if (0 > $this->iWriteOnTimeoutOnly) - { - $this->iWriteOnTimeoutOnly = 0; - } - + $this->iWriteOnTimeoutOnly = \max(0, (int) $iTimeout); return $this; } @@ -225,7 +221,7 @@ abstract class Driver final public function Write(string $sDesc, int $iType = \MailSo\Log\Enumerations\Type::INFO, string $sName = '', bool $bDiplayCrLf = false) { $bResult = true; - if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || 0 < $this->iWriteOnTimeoutOnly)) + if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || $this->iWriteOnTimeoutOnly)) { $bErrorPhp = false; @@ -267,7 +263,7 @@ abstract class Driver $bResult = $this->localWriteImplementation($this->aCache, $bDiplayCrLf); $this->aCache = array(); } - else if (0 < $this->iWriteOnTimeoutOnly && \time() - $_SERVER['REQUEST_TIME_FLOAT'] > $this->iWriteOnTimeoutOnly) + else if ($this->iWriteOnTimeoutOnly && \time() - $_SERVER['REQUEST_TIME_FLOAT'] > $this->iWriteOnTimeoutOnly) { $sFlush = '--- FlushLogCache: WriteOnTimeoutOnly ['.(\time() - $_SERVER['REQUEST_TIME_FLOAT']).'sec]'; if (isset($this->aCache[0]) && empty($this->aCache[0])) @@ -313,7 +309,7 @@ abstract class Driver final public function WriteEmptyLine() : void { - if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || 0 < $this->iWriteOnTimeoutOnly)) + if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || $this->iWriteOnTimeoutOnly)) { $this->aCache[] = ''; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Enumerations/Type.php b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Enumerations/Type.php index 3d333d7f0..b90347e0a 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Enumerations/Type.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Enumerations/Type.php @@ -18,17 +18,19 @@ namespace MailSo\Log\Enumerations; */ abstract class Type { - const INFO = 0; - const NOTICE = 1; - const WARNING = 2; - const ERROR = 3; - const SECURE = 4; - const NOTE = 5; - const TIME = 6; - const MEMORY = 7; - const TIME_DELTA = 8; + const + INFO = 0, + NOTICE = 1, + WARNING = 2, + ERROR = 3, + SECURE = 4, + NOTE = 5, + TIME = 6, + MEMORY = 7, + TIME_DELTA = 8, + DEBUG = 9, - const NOTICE_PHP = 11; - const WARNING_PHP = 12; - const ERROR_PHP = 13; + NOTICE_PHP = 11, + WARNING_PHP = 12, + ERROR_PHP = 13; } diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/log.php b/snappymail/v/0.0.0/app/libraries/snappymail/log.php index 2fc5c12f9..472c09413 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/log.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/log.php @@ -44,7 +44,7 @@ abstract class Log \LOG_WARNING => Type::WARNING, \LOG_NOTICE => Type::NOTICE, \LOG_INFO => Type::INFO, - \LOG_DEBUG => Type::INFO + \LOG_DEBUG => Type::DEBUG ]; protected static function log(int $level, string $prefix, string $msg)