Skip to content

Commit

Permalink
Updated Daemon::getLogPrefix to work regardless of locale. @npub
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo101 committed Nov 14, 2022
1 parent c5722cf commit cfdf019
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,13 @@ public function output(string $msg)
*/
protected function getLogPrefix(): string
{
$time = array_pad(explode('.', microtime(true)), 2, 0);
// timestamp + microseconds
// return sprintf("%s%04d: %d: ", date('Y-m-d H:i:s.', $time[0]), $time[1], $this->pid);
return sprintf("%s%04d: %-6d %6d: ", date('Y-m-d H:i:s.', $time[0]), $time[1], $this->parentPid, getmypid());
$time = explode(' ', microtime(), 2); // array (msec, sec)
return sprintf("%s.%04d: %-6d %6d: ",
date('Y-m-d H:i:s', $time[1]),
str_pad(substr(round($time[0], 4), 2), 4, '0'),
$this->parentPid,
getmypid()
);
}

/**
Expand Down

0 comments on commit cfdf019

Please sign in to comment.