Save IP in logs

{user:ip} in log filename
This commit is contained in:
RainLoop Team 2014-04-26 01:59:26 +04:00
parent d29f20789f
commit 79721f60df
2 changed files with 9 additions and 3 deletions

View file

@ -321,7 +321,12 @@ class Actions
$sFileName
);
}
if (false !== \strpos($sFileName, '{user:ip}'))
{
$sFileName = \str_replace('{user:ip}', $this->Http()->GetClientIp(), $sFileName);
}
$this->ParseQueryAuthString();
$oAccount = $this->getAccountFromToken(false);
@ -748,7 +753,7 @@ class Actions
if (!!$this->Config()->Get('logs', 'enable', true))
{
$sLogFileFullPath = \APP_PRIVATE_DATA.'logs/'.$this->compileLogFileName();
$sLogFileDir = dirname($sLogFileFullPath);
$sLogFileDir = \dirname($sLogFileFullPath);
if (!@is_dir($sLogFileDir))
{
@ -770,7 +775,7 @@ class Actions
$oHttp->GetMethod().': '.$oHttp->GetHost(false, false).$oHttp->GetServer('REQUEST_URI', ''),
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
$this->oLogger->Write('[PHP:'.PHP_VERSION.'][RL:'.APP_VERSION.'][DATE:'.\gmdate('d.m.y').']');
$this->oLogger->Write('[PHP:'.PHP_VERSION.'][RL:'.APP_VERSION.'][DATE:'.\gmdate('d.m.y').'][IP:'.$oHttp->GetClientIp().']');
}
}

View file

@ -156,6 +156,7 @@ Patterns:
{user:domain} - Replaced by user\'s domain name
If user is not logged in, value is set to "unknown"
{user:uid} - Replaced by user\'s UID regardless of account currently used
{user:ip} - Replaced by user\'s IP address
Examples:
filename = "log-{date:Y-m-d}.txt"