mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 23:29:54 +00:00
Utils: Make kill() use static MainLogger instead of global variable
This commit is contained in:
parent
5f7c884255
commit
73e56c8a36
@ -70,6 +70,14 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
return static::$logger;
|
return static::$logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a MainLogger instance is statically registered on this thread.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isRegisteredStatic() : bool{
|
||||||
|
return static::$logger !== null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns the MainLogger instance to the {@link MainLogger#logger} static property.
|
* Assigns the MainLogger instance to the {@link MainLogger#logger} static property.
|
||||||
*
|
*
|
||||||
|
@ -545,9 +545,8 @@ class Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function kill($pid) : void{
|
public static function kill($pid) : void{
|
||||||
global $logger;
|
if(MainLogger::isRegisteredStatic()){
|
||||||
if($logger instanceof MainLogger){
|
MainLogger::getLogger()->syncFlushBuffer();
|
||||||
$logger->syncFlushBuffer();
|
|
||||||
}
|
}
|
||||||
switch(Utils::getOS()){
|
switch(Utils::getOS()){
|
||||||
case "win":
|
case "win":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user