mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Merge master
This commit is contained in:
@ -54,22 +54,22 @@ class MainLogger extends \AttachableThreadedLogger{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MainLogger|null
|
||||
* @return MainLogger
|
||||
*/
|
||||
public static function getLogger(){
|
||||
public static function getLogger() : MainLogger{
|
||||
return static::$logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns the MainLogger instance to the {@link MainLogger#logger} static property. Because static properties are
|
||||
* thread-local, this must be called from the body of every Thread if you want the logger to be accessible via
|
||||
* {@link MainLogger#getLogger}.
|
||||
* Assigns the MainLogger instance to the {@link MainLogger#logger} static property.
|
||||
*
|
||||
* WARNING: Because static properties are thread-local, this MUST be called from the body of every Thread if you
|
||||
* want the logger to be accessible via {@link MainLogger#getLogger}.
|
||||
*/
|
||||
public function registerStatic(){
|
||||
if(static::$logger instanceof MainLogger){
|
||||
throw new \RuntimeException("MainLogger has been already registered");
|
||||
if(static::$logger === null){
|
||||
static::$logger = $this;
|
||||
}
|
||||
static::$logger = $this;
|
||||
}
|
||||
|
||||
public function emergency($message){
|
||||
|
Reference in New Issue
Block a user