1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

Update return types

This commit is contained in:
Jordi Boggiano
2018-11-19 14:40:44 +01:00
parent 6bb347c040
commit 1c5b0b8ff4
13 changed files with 63 additions and 82 deletions

View File

@@ -58,11 +58,11 @@ class DeduplicationHandler extends BufferHandler
/**
* @param HandlerInterface $handler Handler.
* @param string $deduplicationStore The file/path where the deduplication log should be kept
* @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
* @param string|int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
* @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
*/
public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, bool $bubble = true)
public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, int $time = 60, bool $bubble = true)
{
parent::__construct($handler, 0, Logger::DEBUG, $bubble, false);
@@ -71,7 +71,7 @@ class DeduplicationHandler extends BufferHandler
$this->time = $time;
}
public function flush()
public function flush(): void
{
if ($this->bufferSize === 0) {
return;
@@ -100,7 +100,7 @@ class DeduplicationHandler extends BufferHandler
}
}
private function isDuplicate(array $record)
private function isDuplicate(array $record): bool
{
if (!file_exists($this->deduplicationStore)) {
return false;
@@ -130,10 +130,10 @@ class DeduplicationHandler extends BufferHandler
return false;
}
private function collectLogs()
private function collectLogs(): void
{
if (!file_exists($this->deduplicationStore)) {
return false;
return;
}
$handle = fopen($this->deduplicationStore, 'rw+');
@@ -161,7 +161,7 @@ class DeduplicationHandler extends BufferHandler
$this->gc = false;
}
private function appendRecord(array $record)
private function appendRecord(array $record): void
{
file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND);
}