76 if ($this->bufferSize === 0) {
82 foreach ($this->buffer as $record) {
83 if ($record[
'level'] >= $this->deduplicationLevel) {
85 $passthru = $passthru || !$this->
isDuplicate($record);
93 if ($passthru ===
true || $passthru === null) {
94 $this->handler->handleBatch($this->buffer);
106 if (!file_exists($this->deduplicationStore)) {
110 $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
115 $yesterday = time() - 86400;
116 $timestampValidity = $record[
'datetime']->getTimestamp() -
$this->time;
117 $expectedMessage = preg_replace(
'{[\r\n].*}',
'', $record[
'message']);
136 if (!file_exists($this->deduplicationStore)) {
140 $handle =
fopen($this->deduplicationStore,
'rw+');
141 flock($handle, LOCK_EX);
142 $validLogs = array();
146 while (!feof($handle)) {
147 $log = fgets($handle);
148 if (substr(
$log, 0, 10) >= $timestampValidity) {
153 ftruncate($handle, 0);
155 foreach ($validLogs as
$log) {
156 fwrite($handle, $log);
159 flock($handle, LOCK_UN);
167 file_put_contents($this->deduplicationStore, $record[
'datetime']->getTimestamp() .
':' . $record[
'level_name'] .
':' . preg_replace(
'{[\r\n].*}',
'', $record[
'message']) .
"\n", FILE_APPEND);
const DEBUG
Detailed debug information.
__construct(HandlerInterface $handler, $deduplicationStore=null, $deduplicationLevel=Logger::ERROR, $time=60, $bubble=true)
const ERROR
Runtime errors.
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Buffers all records until closing the handler and then pass them as batch.
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
appendRecord(array $record)
isDuplicate(array $record)
catch(Exception $e) $message
Simple handler wrapper that deduplicates log records across multiple requests.
foreach($mandatory_scripts as $file) $timestamp
Interface that all Monolog Handlers must implement.
clear()
Clears the buffer without flushing any messages down to the wrapped handler.