ttrss/classes/Logger_Stdout.php

32 lines
614 B
PHP
Raw Permalink Normal View History

2018-08-15 12:08:31 +00:00
<?php
class Logger_Stdout implements Logger_Adapter {
2018-08-15 12:08:31 +00:00
2021-11-10 21:38:25 +00:00
function log_error(int $errno, string $errstr, string $file, int $line, string $context): bool {
2018-08-15 12:08:31 +00:00
switch ($errno) {
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
$priority = LOG_ERR;
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
$priority = LOG_WARNING;
break;
default:
$priority = LOG_INFO;
}
2021-02-25 12:49:30 +00:00
$errname = Logger::ERROR_NAMES[$errno] . " ($errno)";
2018-08-15 12:08:31 +00:00
print "[EEE] $priority $errname ($file:$line) $errstr\n";
2021-11-10 21:38:25 +00:00
return true;
2018-08-15 12:08:31 +00:00
}
}