PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
GlobalLogger.php
1<?php
2
3/*
4 * PocketMine Standard PHP Library
5 * Copyright (C) 2018 PocketMine Team <https://github.com/pmmp/PocketMine-SPL>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16*/
17
18
19declare(strict_types=1);
20
24final class GlobalLogger{
25
26 private function __construct(){
27 //NOOP
28 }
29
30 private static ?\Logger $logger = null;
31
32 public static function get() : \Logger{
33 if(self::$logger === null){
34 self::$logger = new SimpleLogger();
35 }
36 return self::$logger;
37 }
38
39 public static function set(\Logger $logger) : void{
40 self::$logger = $logger;
41 }
42}