tt-rss/classes/Logger_Stdout.php
Felix Geyer d76fcb94ea Fix stdout logger to actually write to stdout
print writes into the HTTP response which is not where logs should end
up.
2025-10-22 22:58:08 +02:00

20 lines
573 B
PHP

<?php
class Logger_Stdout implements Logger_Adapter {
function log_error(int $errno, string $errstr, string $file, int $line, string $context): bool {
$priority = match ($errno) {
E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR => LOG_ERR,
E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING => LOG_WARNING,
default => LOG_INFO,
};
$errname = Logger::ERROR_NAMES[$errno] . " ($errno)";
file_put_contents("php://stdout", "[EEE] $priority $errname ($file:$line) $errstr\n");
return true;
}
}