1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 01:25:56 +00:00

make logging configurable; add logging to syslog

This commit is contained in:
Andrew Dolgov
2013-04-19 09:45:43 +04:00
parent f1c6dd7e90
commit b367c951b9
7 changed files with 114 additions and 55 deletions

View File

@@ -2,9 +2,6 @@
class Logger_SQL {
function log_error($errno, $errstr, $file, $line, $context) {
if ($errno == E_NOTICE) return false;
if (Db::get() && get_schema_version() > 117) {
$errno = Db::get()->escape_string($errno);

31
classes/logger/syslog.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
class Logger_Syslog {
function log_error($errno, $errstr, $file, $line, $context) {
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;
}
$errname = Logger::$errornames[$errno] . " ($errno)";
syslog($priority, "[tt-rss] $errname ($file:$line) $errstr");
}
}
?>