mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-14 18:04:02 +02:00
Refactor PHP.
This commit is contained in:
@@ -4,6 +4,10 @@ class Logger {
|
||||
private static $start;
|
||||
private static $prev;
|
||||
|
||||
private static function time() {
|
||||
return microtime(true) * 1000; // sec * 1000 = ms
|
||||
}
|
||||
|
||||
public static function init() {
|
||||
self::$start = self::time();
|
||||
self::$prev = self::$start;
|
||||
@@ -11,10 +15,6 @@ class Logger {
|
||||
Logger::log('--------------------------------');
|
||||
}
|
||||
|
||||
private static function time() {
|
||||
return microtime(true) * 1000; // sec * 1000 = ms
|
||||
}
|
||||
|
||||
public static function log($message=null, $obj=null) {
|
||||
$now = self::time();
|
||||
$message = number_format($now - self::$start, 3) . ' ' . number_format($now - self::$prev, 3) . ' ' . $message;
|
||||
@@ -24,4 +24,5 @@ class Logger {
|
||||
self::$prev = $now;
|
||||
}
|
||||
}
|
||||
|
||||
Logger::init();
|
||||
|
Reference in New Issue
Block a user