1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
/**
* Log to console. Useful as a dummy replacement for a proper logger.
* */
class ConsoleLogger implements iLogger {
// generic appender
private function append($msg) {
print $msg."\n";
}
// append message to general error log
public function error($msg) {
$this->append('error: '.$msg);
}
// append message to database error log
public function dberror($msg, $sql_error, $query = null) {
print('-------------------------------------------------------------------------------'."\n");
print('DATETIME='.date('r')."\n");
print('ERROR='.$sql_error."\n");
print('SQL='.$query."\n");
}
// append message to database statement log
public function dbstmt($query) {
$this->append('dbstmt: '.$query);
}
// append message to log of potential security breach attempts
public function badboy($msg) {
$this->append('badboy: '.$msg);
}
}
?>
|