Skip to content

Commit

Permalink
add: clearer restart message
Browse files Browse the repository at this point in the history
  • Loading branch information
blacknell committed Nov 30, 2020
1 parent 01d2930 commit 00041ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Watchdog.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function watch($watchScript, $watchScriptGrep, $watchdogFile, $watchdogMa
$this->logger->debug(sprintf("Watchdog file last touched %s, %s", $fileModificationTime->format(Watchdog::LOG_DATE_FORMAT), $fileModificationTime->fromNow()->getRelative()));

if (($now->getTimestamp() - $fileModificationTime->getTimestamp()) > $watchdogMaxAge) {
$this->logger->notice(sprintf("Watchdog file %s is more than %u seconds old. Last touched %s, %s", $watchdogFile, $watchdogMaxAge, $fileModificationTime->format(Watchdog::LOG_DATE_FORMAT), $fileModificationTime->fromNow()->getRelative()), [$hostName, $ipAddress]);
$this->logger->notice(sprintf("Watchdog file %s is more than %u seconds old. Last touched %s, %s. Restarting.", $watchdogFile, $watchdogMaxAge, $fileModificationTime->format(Watchdog::LOG_DATE_FORMAT), $fileModificationTime->fromNow()->getRelative()), [$hostName, $ipAddress]);
$watchdogDead = true;
}
}
Expand All @@ -90,7 +90,7 @@ public function watch($watchScript, $watchScriptGrep, $watchdogFile, $watchdogMa
$fileModificationTime = new Moment();
$fileModificationTime->setTimestamp(filemtime($watchfile));
if ($fileModificationTime->isAfter($processStartTime)) {
$this->logger->notice(sprintf("Watch file %s changed %s since process started %s", $watchfile, $fileModificationTime->format(Watchdog::LOG_DATE_FORMAT), $processStartTime->format(Watchdog::LOG_DATE_FORMAT)), [$hostName, $ipAddress]);
$this->logger->notice(sprintf("Watch file %s changed %s since process started %s. Restarting.", $watchfile, $fileModificationTime->format(Watchdog::LOG_DATE_FORMAT), $fileModificationTime->from($processStartTime)->getRelative()), [$hostName, $ipAddress]);
$watchFilesHaveChanged = true;
break 2;
}
Expand Down

0 comments on commit 00041ab

Please sign in to comment.