Added notice and warning function to Log (#143)
This commit is contained in:
parent
d9b48f4080
commit
39131033db
@ -10,25 +10,44 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
|
|
||||||
class Log extends Module {
|
class Log extends Module {
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static function error($database, $function, $line, $text = '') {
|
public static function error($database, $function, $line, $text = '') {
|
||||||
|
|
||||||
|
return Log::text($database, 'error', $function, $line, $text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function text($database, $type, $function, $line, $text = '') {
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
Module::dependencies(isset($database, $function, $line, $text));
|
Module::dependencies(isset($database, $type, $function, $line, $text));
|
||||||
|
|
||||||
# Get time
|
# Get time
|
||||||
$sysstamp = time();
|
$sysstamp = time();
|
||||||
|
|
||||||
# Escape
|
# Escape
|
||||||
|
$type = mysqli_real_escape_string($type, $function);
|
||||||
$function = mysqli_real_escape_string($database, $function);
|
$function = mysqli_real_escape_string($database, $function);
|
||||||
$line = mysqli_real_escape_string($database, $line);
|
$line = mysqli_real_escape_string($database, $line);
|
||||||
$text = mysqli_real_escape_string($database, $text);
|
$text = mysqli_real_escape_string($database, $text);
|
||||||
|
|
||||||
# Save in database
|
# Save in database
|
||||||
$query = "INSERT INTO lychee_log (time, type, function, line, text) VALUES ('$sysstamp', 'error', '$function', '$line', '$text');";
|
$query = "INSERT INTO lychee_log (time, type, function, line, text) VALUES ('$sysstamp', '$type', '$function', '$line', '$text');";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
|
|
||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
return $database->insert_id;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user