Skip to content

Commit a0e3d9c

Browse files
committed
- clear the processor list (ie. if instance is shared)
1 parent 5e1ab79 commit a0e3d9c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

Log.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,23 @@ class Log implements Logger
6565
use LoggerTrait;
6666

6767
private const DATE_FORMAT = 'd/m/Y H:i:s.u';
68-
6968
private DateTimeZone $timezone;
7069

71-
/**
72-
* @var array<int, Processor> Hash with all registered log processors.
73-
*/
74-
private array $processors = [];
75-
7670
/**
7771
* Creates all requested log processors.
7872
*
79-
* @param array $processors a list of log processors
73+
* @param array<int, Processor> $processors a list of log processors
8074
* @param string $dateformat The date format for the messages
8175
* @param string $timezone The timezone for the messages
8276
*/
8377
public function __construct(
84-
array $processors,
78+
private array $processors = [],
8579
private string $dateformat = self::DATE_FORMAT,
8680
string $timezone = 'UTC')
8781
{
8882
$this->timezone = @timezone_open($timezone) ?: timezone_open('UTC');
89-
foreach ($processors as $processor) {
83+
foreach ($processors as $i => $processor) {
84+
unset($this->processors[$i]);
9085
$this->attach(new $processor['class']($processor));
9186
}
9287
}

0 commit comments

Comments
 (0)