PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
SimpleLogger.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
18declare(strict_types=1);
19
20class SimpleLogger implements \Logger{
21 public function emergency($message){
22 $this->log(LogLevel::EMERGENCY, $message);
23 }
24
25 public function alert($message){
26 $this->log(LogLevel::ALERT, $message);
27 }
28
29 public function critical($message){
30 $this->log(LogLevel::CRITICAL, $message);
31 }
32
33 public function error($message){
34 $this->log(LogLevel::ERROR, $message);
35 }
36
37 public function warning($message){
38 $this->log(LogLevel::WARNING, $message);
39 }
40
41 public function notice($message){
42 $this->log(LogLevel::NOTICE, $message);
43 }
44
45 public function info($message){
46 $this->log(LogLevel::INFO, $message);
47 }
48
49 public function debug($message){
50 $this->log(LogLevel::DEBUG, $message);
51 }
52
53 public function log($level, $message){
54 echo "[" . strtoupper($level) . "] " . $message . PHP_EOL;
55 }
56
57 public function logException(\Throwable $e, $trace = null){
58 $this->critical($e->getMessage());
59 echo $e->getTraceAsString();
60 }
61}
critical($message)
alert($message)
log($level, $message)
error($message)
notice($message)
warning($message)
logException(\Throwable $e, $trace=null)
info($message)
debug($message)
emergency($message)