Skip to content

Commit

Permalink
Update ErrorLogger.php
Browse files Browse the repository at this point in the history
  • Loading branch information
thorewi authored Aug 7, 2023
1 parent 827b392 commit 06c5e9b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ErrorLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function sendEmail($message): void

self::writeToLogFile($errorSnoozeLog, $line . ' ' . $messageHash);

// MAX EMAILS PER DY
// MAX EMAILS PER DAY

$maxEmailsPerDayLog = $this->directory . '/max-emails-per-day.log';

Expand All @@ -118,16 +118,16 @@ protected function sendEmail($message): void
@unlink($maxEmailsPerDayLog);
}

$logContent = @file_get_contents($errorSnoozeLog);
$logContent = @file_get_contents($maxEmailsPerDayLog);

if (substr_count($logContent, date('Y-m-d')) >= $this->maxEmailsPerDay) {
file_put_contents('adasd', count(file($maxEmailsPerDayLog)));

if (count(file($maxEmailsPerDayLog)) >= $this->maxEmailsPerDay) {
// Limit per day exceeded
return;
}

if (!@file_put_contents($errorSnoozeLog, $line . ' ' . $messageHash . PHP_EOL, FILE_APPEND | LOCK_EX)) {
throw new RuntimeException("Unable to write to log file '" . $errorSnoozeLog . "'. Is directory writable?");
}
self::writeToLogFile($maxEmailsPerDayLog, $line . ' ' . $messageHash);

// SEND EMAIL

Expand Down

0 comments on commit 06c5e9b

Please sign in to comment.