/** * @return \MailSo\Log\Logger */ public function LoggerAuth() { if (null === $this->oLoggerAuth) { $this->oLoggerAuth = \MailSo\Log\Logger::NewInstance(false); if (!!$this->Config()->Get('logs', 'auth_logging', false)) { $sAuthLogFileFullPath = \APP_PRIVATE_DATA . 'logs/' . $this->compileLogFileName($this->Config()->Get('logs', 'auth_logging_filename', '')); $sLogFileDir = \dirname($sAuthLogFileFullPath); if (!@is_dir($sLogFileDir)) { @mkdir($sLogFileDir, 0755, true); } $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::MEMORY); $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME); $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME_DELTA); $this->oLoggerAuth->Add(\MailSo\Log\Drivers\File::NewInstance($sAuthLogFileFullPath)); } } return $this->oLoggerAuth; }
/** * @return \MailSo\Log\Logger */ public function Logger() { if (null === $this->oLogger) { $this->oLogger = \MailSo\Log\Logger::SingletonInstance(); if (!!$this->Config()->Get('logs', 'enable', true)) { $this->oLogger->SetShowSecter(!$this->Config()->Get('logs', 'hide_passwords', true)); $sLogFileFullPath = \APP_PRIVATE_DATA . 'logs/' . $this->compileLogFileName(); $sLogFileDir = \dirname($sLogFileFullPath); if (!@is_dir($sLogFileDir)) { @mkdir($sLogFileDir, 0755, true); } $this->oLogger->Add(\MailSo\Log\Drivers\File::NewInstance($sLogFileFullPath)->WriteOnErrorOnly($this->Config()->Get('logs', 'write_on_error_only', true))->WriteOnTimeoutOnly($this->Config()->Get('logs', 'write_on_timeout_only', 30))); if (!$this->Config()->Get('debug', 'enable', false)) { $this->oLogger->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME); } $this->oLogger->WriteEmptyLine(); $oHttp = $this->Http(); $this->oLogger->Write('[DATE:' . \gmdate('d.m.y') . '][RL:' . APP_VERSION . '][PHP:' . PHP_VERSION . '][IP:' . $oHttp->GetClientIp() . '][PID:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][GUID:' . \MailSo\Log\Logger::Guid() . ']'); $this->oLogger->Write('[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''), \MailSo\Log\Enumerations\Type::NOTE, 'REQUEST'); } } return $this->oLogger; }