]>
Commit | Line | Data |
---|---|---|
889a5f9f AD |
1 | <?php |
2 | class Logger_SQL { | |
3 | ||
889a5f9f AD |
4 | function log_error($errno, $errstr, $file, $line, $context) { |
5 | ||
6 | if ($errno == E_NOTICE) return false; | |
7 | ||
95947917 | 8 | if (Db::get()) { |
aca75cb5 | 9 | |
95947917 AD |
10 | $errno = Db::get()->escape_string($errno); |
11 | $errstr = Db::get()->escape_string($errstr); | |
12 | $file = Db::get()->escape_string($file); | |
13 | $line = Db::get()->escape_string($line); | |
4e53956a | 14 | $context = ''; // backtrace is a lot of data which is not really critical to store |
6322ac79 | 15 | //$context = db_escape_string( serialize($context)); |
889a5f9f AD |
16 | |
17 | $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL"; | |
18 | ||
95947917 | 19 | $result = Db::get()->query( |
889a5f9f AD |
20 | "INSERT INTO ttrss_error_log |
21 | (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES | |
22 | ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())"); | |
23 | ||
95947917 | 24 | return Db::get()->affected_rows($result) != 0; |
889a5f9f | 25 | } |
aca75cb5 | 26 | |
889a5f9f AD |
27 | return false; |
28 | } | |
29 | ||
30 | } | |
31 | ?> |