mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Improved logging
Small fixes
This commit is contained in:
parent
187e44607d
commit
6c28b24aaf
11 changed files with 301 additions and 246 deletions
|
|
@ -23,6 +23,11 @@ abstract class Driver
|
|||
*/
|
||||
protected $aPrefixes;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $bGuidPrefix;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -62,6 +67,7 @@ abstract class Driver
|
|||
$this->sName = 'INFO';
|
||||
$this->bTimePrefix = true;
|
||||
$this->bTypedPrefix = true;
|
||||
$this->bGuidPrefix = true;
|
||||
|
||||
$this->iWriteOnTimeoutOnly = 0;
|
||||
$this->bWriteOnErrorOnly = false;
|
||||
|
|
@ -80,6 +86,15 @@ abstract class Driver
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function DisableGuidPrefix()
|
||||
{
|
||||
$this->bGuidPrefix = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
|
|
@ -150,9 +165,11 @@ abstract class Driver
|
|||
protected function loggerLineImplementation($sTimePrefix, $sDesc,
|
||||
$iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '')
|
||||
{
|
||||
return ($this->bTimePrefix ? '['.$sTimePrefix.'] ' : '').
|
||||
($this->bTypedPrefix ? $this->getTypedPrefix($iType, $sName) : '').
|
||||
$sDesc;
|
||||
return \ltrim(
|
||||
($this->bTimePrefix ? '['.$sTimePrefix.']' : '').
|
||||
($this->bGuidPrefix ? '['.\MailSo\Log\Logger::Guid().']' : '').
|
||||
($this->bTypedPrefix ? ' '.$this->getTypedPrefix($iType, $sName) : '')
|
||||
).$sDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -215,6 +232,7 @@ abstract class Driver
|
|||
array_unshift($this->aCache, $sFlush);
|
||||
}
|
||||
|
||||
$this->aCache[] = '--- FlushLogCache: Trigger';
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
|
||||
|
||||
$this->bFlushCache = true;
|
||||
|
|
@ -234,6 +252,7 @@ abstract class Driver
|
|||
array_unshift($this->aCache, $sFlush);
|
||||
}
|
||||
|
||||
$this->aCache[] = '--- FlushLogCache: Trigger';
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
|
||||
|
||||
$this->bFlushCache = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue