Merge Actions::LoggerAuth() into Actions::LoggerAuthHelper()

This commit is contained in:
the-djmaze 2024-03-08 02:36:39 +01:00
parent 6e24f45d4a
commit f32f5347a7

View file

@ -532,8 +532,10 @@ class Actions
return $this->oPlugins; return $this->oPlugins;
} }
public function LoggerAuth(): \MailSo\Log\Logger protected function LoggerAuthHelper(?Model\Account $oAccount = null, array $aAdditionalParams = array(), bool $admin = false): void
{ {
$sLine = $this->oConfig->Get('logs', 'auth_logging_format', '');
if (!empty($sLine)) {
if (!$this->oLoggerAuth) { if (!$this->oLoggerAuth) {
$this->oLoggerAuth = new \MailSo\Log\Logger(false); $this->oLoggerAuth = new \MailSo\Log\Logger(false);
if ($this->oConfig->Get('logs', 'auth_logging', false)) { if ($this->oConfig->Get('logs', 'auth_logging', false)) {
@ -551,14 +553,7 @@ class Actions
); );
} }
} }
return $this->oLoggerAuth; $this->oLoggerAuth->Write($this->compileLogParams($sLine, $oAccount, $aAdditionalParams), \LOG_WARNING);
}
protected function LoggerAuthHelper(?Model\Account $oAccount = null, array $aAdditionalParams = array(), bool $admin = false): void
{
$sLine = $this->oConfig->Get('logs', 'auth_logging_format', '');
if (!empty($sLine)) {
$this->LoggerAuth()->Write($this->compileLogParams($sLine, $oAccount, $aAdditionalParams), \LOG_WARNING);
} }
if (($this->oConfig->Get('logs', 'auth_logging', false) || $this->oConfig->Get('logs', 'auth_syslog', false)) if (($this->oConfig->Get('logs', 'auth_logging', false) || $this->oConfig->Get('logs', 'auth_syslog', false))
&& \openlog('snappymail', 0, \LOG_AUTHPRIV)) { && \openlog('snappymail', 0, \LOG_AUTHPRIV)) {