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);
111 if (!is_array($store)) {
115 $yesterday =
time() - 86400;
116 $timestampValidity = $record[
'datetime']->getTimestamp() -
$this->time;
117 $expectedMessage = preg_replace(
'{[\r\n].*}',
'', $record[
'message']);
119 for ($i = count($store) - 1; $i >= 0; $i--) {
122 if (
$level === $record[
'level_name'] && $message === $expectedMessage &&
$timestamp > $timestampValidity) {
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.
appendRecord(array $record)
isDuplicate(array $record)
Simple handler wrapper that deduplicates log records across multiple requests.
Reload workbook from saved file
Create styles array
The data for the language used.
foreach($mandatory_scripts as $file) $timestamp
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Interface that all Monolog Handlers must implement.
clear()
Clears the buffer without flushing any messages down to the wrapped handler.