Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class Log |
||
15 | { |
||
16 | /** |
||
17 | * $logger. |
||
18 | * |
||
19 | * @var Logger |
||
20 | */ |
||
21 | public static $logger; |
||
22 | |||
23 | /** |
||
24 | * Sets the current logger. |
||
25 | * |
||
26 | * @param Logger $l |
||
27 | */ |
||
28 | 4 | public static function setLogger(Logger $l): void |
|
29 | { |
||
30 | 4 | self::$logger = $l; |
|
31 | 2 | } |
|
32 | |||
33 | /** |
||
34 | * Returns the current logger. |
||
35 | * |
||
36 | * @return Logger |
||
37 | */ |
||
38 | 210 | public static function getLogger(): Logger |
|
39 | { |
||
40 | 210 | return self::$logger; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * Prints the log. |
||
45 | * |
||
46 | * @param mixed ...$v |
||
47 | */ |
||
48 | 336 | public static function logPrint(...$v): void |
|
49 | { |
||
50 | 336 | self::$logger->write(...$v); |
|
51 | 224 | } |
|
52 | |||
53 | /** |
||
54 | * Prints the log with the format. |
||
55 | * |
||
56 | * @param string $format |
||
57 | * @param mixed ...$v |
||
58 | */ |
||
59 | 333 | public static function logPrintf(string $format, ...$v): void |
|
62 | 222 | } |
|
63 | } |
||
64 | |||
65 | Log::setLogger(new DefaultLogger()); |
||
66 |