2014-05-06 19:22:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
###
|
|
|
|
# @name Log Module
|
2015-02-01 21:08:37 +00:00
|
|
|
# @copyright 2015 by Tobias Reich
|
2014-05-06 19:22:56 +00:00
|
|
|
###
|
|
|
|
|
|
|
|
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|
|
|
|
|
|
|
class Log extends Module {
|
|
|
|
|
2014-05-06 20:11:37 +00:00
|
|
|
public static function notice($database, $function, $line, $text = '') {
|
|
|
|
|
|
|
|
return Log::text($database, 'notice', $function, $line, $text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function warning($database, $function, $line, $text = '') {
|
|
|
|
|
|
|
|
return Log::text($database, 'warning', $function, $line, $text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-06 19:22:56 +00:00
|
|
|
public static function error($database, $function, $line, $text = '') {
|
|
|
|
|
2014-05-06 20:11:37 +00:00
|
|
|
return Log::text($database, 'error', $function, $line, $text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function text($database, $type, $function, $line, $text = '') {
|
|
|
|
|
2014-05-06 19:22:56 +00:00
|
|
|
# Check dependencies
|
2014-05-06 20:11:37 +00:00
|
|
|
Module::dependencies(isset($database, $type, $function, $line, $text));
|
2014-05-06 19:22:56 +00:00
|
|
|
|
|
|
|
# Get time
|
|
|
|
$sysstamp = time();
|
|
|
|
|
|
|
|
# Save in database
|
2014-08-30 05:05:26 +00:00
|
|
|
$query = Database::prepare($database, "INSERT INTO ? (time, type, function, line, text) VALUES ('?', '?', '?', '?', '?')", array(LYCHEE_TABLE_LOG, $sysstamp, $type, $function, $line, $text));
|
2014-05-06 19:22:56 +00:00
|
|
|
$result = $database->query($query);
|
|
|
|
|
|
|
|
if (!$result) return false;
|
2014-05-06 20:11:37 +00:00
|
|
|
return true;
|
2014-05-06 19:22:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|