1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 01:05: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

@@ -1,22 +1,12 @@
<?php
// TODO: make configurable
require_once "classes/logger.php";
require_once "classes/logger/sql.php";
function ttrss_error_handler($errno, $errstr, $file, $line, $context) {
global $logger;
if (error_reporting() == 0 || !$errno) return false;
if (!$logger) $logger = new Logger_SQL();
$file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
if ($logger) {
return $logger->log_error($errno, $errstr, $file, $line, $context);
}
return false;
return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
}
function ttrss_fatal_handler() {
@@ -36,14 +26,7 @@ function ttrss_fatal_handler() {
$file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
if (!$logger) $logger = new Logger_SQL();
if ($logger) {
if ($logger->log_error($errno, $errstr, $file, $line, $context)) {
return true;
}
}
return false;
return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
}
return false;