mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 10:45:56 +00:00
use self:: in some places to invoke static methods from the same class
This commit is contained in:
@@ -11,40 +11,40 @@ class Debug {
|
||||
private static $loglevel = 0;
|
||||
|
||||
public static function set_logfile($logfile) {
|
||||
Debug::$logfile = $logfile;
|
||||
self::$logfile = $logfile;
|
||||
}
|
||||
|
||||
public static function enabled() {
|
||||
return Debug::$enabled;
|
||||
return self::$enabled;
|
||||
}
|
||||
|
||||
public static function set_enabled($enable) {
|
||||
Debug::$enabled = $enable;
|
||||
self::$enabled = $enable;
|
||||
}
|
||||
|
||||
public static function set_quiet($quiet) {
|
||||
Debug::$quiet = $quiet;
|
||||
self::$quiet = $quiet;
|
||||
}
|
||||
|
||||
public static function set_loglevel($level) {
|
||||
Debug::$loglevel = $level;
|
||||
self::$loglevel = $level;
|
||||
}
|
||||
|
||||
public static function get_loglevel() {
|
||||
return Debug::$loglevel;
|
||||
return self::$loglevel;
|
||||
}
|
||||
|
||||
public static function log($message, $level = 0) {
|
||||
|
||||
if (!Debug::$enabled || Debug::$loglevel < $level) return false;
|
||||
if (!self::$enabled || self::$loglevel < $level) return false;
|
||||
|
||||
$ts = strftime("%H:%M:%S", time());
|
||||
if (function_exists('posix_getpid')) {
|
||||
$ts = "$ts/" . posix_getpid();
|
||||
}
|
||||
|
||||
if (Debug::$logfile) {
|
||||
$fp = fopen(Debug::$logfile, 'a+');
|
||||
if (self::$logfile) {
|
||||
$fp = fopen(self::$logfile, 'a+');
|
||||
|
||||
if ($fp) {
|
||||
$locked = false;
|
||||
@@ -60,7 +60,7 @@ class Debug {
|
||||
|
||||
if (!$locked) {
|
||||
fclose($fp);
|
||||
user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING);
|
||||
user_error("Unable to lock debugging log file: " . self::$logfile, E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -73,14 +73,14 @@ class Debug {
|
||||
|
||||
fclose($fp);
|
||||
|
||||
if (Debug::$quiet)
|
||||
if (self::$quiet)
|
||||
return;
|
||||
|
||||
} else {
|
||||
user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING);
|
||||
user_error("Unable to open debugging log file: " . self::$logfile, E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
print "[$ts] $message\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user