2013-04-19 05:45:43 +00:00
|
|
|
<?php
|
2021-02-25 14:10:03 +00:00
|
|
|
class Logger_Syslog implements Logger_Adapter {
|
2013-04-19 05:45:43 +00:00
|
|
|
|
2021-02-25 14:10:03 +00:00
|
|
|
function log_error(int $errno, string $errstr, string $file, int $line, $context) {
|
2013-04-19 05:45:43 +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)";
|
2013-04-19 05:45:43 +00:00
|
|
|
|
|
|
|
syslog($priority, "[tt-rss] $errname ($file:$line) $errstr");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-02-08 16:42:10 +00:00
|
|
|
}
|