Skip to content

Commit

Permalink
Replace strftime() with date() (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
tspencer244 authored Nov 10, 2023
1 parent 6e9677c commit 6ef8c46
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Resque/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function log($level, string|\Stringable $message, array $context = []): v
if ($this->verbose) {
fwrite(
STDOUT,
'[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
'[' . $level . '] [' . date('H:i:s Y-m-d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)

// Forked and we're the child. Or PCNTL is not installed. Run the job.
if ($this->child === 0 || $this->child === false || $this->child === -1) {
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T');
$status = 'Processing ' . $job->queue . ' since ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(Psr\Log\LogLevel::INFO, $status);

Expand All @@ -251,7 +251,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)

if($this->child > 0) {
// Parent process, sit and wait
$status = 'Forked ' . $this->child . ' at ' . strftime('%F %T');
$status = 'Forked ' . $this->child . ' at ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(Psr\Log\LogLevel::INFO, $status);

Expand Down
2 changes: 1 addition & 1 deletion lib/ResqueScheduler/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function log($message)
if($this->logLevel == self::LOG_NORMAL) {
fwrite(STDOUT, "*** " . $message . "\n");
} elseif($this->logLevel == self::LOG_VERBOSE) {
fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n");
fwrite(STDOUT, "** [" . date('H:i:s Y-m-d') . "] " . $message . "\n");
}
}

Expand Down

0 comments on commit 6ef8c46

Please sign in to comment.