Log signal info for #1569

This commit is contained in:
the-djmaze 2024-04-30 02:26:20 +02:00
parent cc360837b1
commit 73ac962289

View file

@ -206,20 +206,18 @@ class Logger extends \SplFixedArray
} }
} }
public function signalHandler($signo) public function signalHandler($signo, /*?array*/$siginfo = null)
{ {
if (\SIGTERM == $signo) { if (\SIGTERM == $signo) {
exit; exit;
} }
if ($this->bUsed) {
foreach (static::$SIGNALS as $SIGNAL) { foreach (static::$SIGNALS as $SIGNAL) {
if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) { if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) {
$this->Write("Caught {$SIGNAL}"); $this->Write("Caught {$SIGNAL} ".($siginfo ? \json_encode($siginfo) : ''), \LOG_CRIT, 'PHP');
break; break;
} }
} }
} }
}
public function Write(string $sDesc, int $iType = \LOG_INFO, string $sName = '', bool $bDiplayCrLf = false) : bool public function Write(string $sDesc, int $iType = \LOG_INFO, string $sName = '', bool $bDiplayCrLf = false) : bool
{ {