1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace GLFramework;
10:
11:
12: use Psr\Log\AbstractLogger;
13:
14: class Log extends AbstractLogger
15: {
16:
17: private static $instance;
18:
19: 20: 21:
22: public function __construct()
23: {
24: self::$instance = $this;
25: }
26:
27: 28: 29:
30: public static function getInstance()
31: {
32: if(self::$instance == null) self::$instance = new Log();
33: return self::$instance;
34: }
35:
36:
37:
38: 39: 40: 41: 42: 43: 44: 45:
46: public function log($level, $message, array $context = array())
47: {
48:
49: if(!in_array('events', $context))
50: Events::fire('onLog', array($message, $level));
51: }
52:
53: public static function em($message, array $context = array())
54: {
55: self::getInstance()->emergency($message, $context);
56: }
57:
58: public static function a($message, array $context = array())
59: {
60: self::getInstance()->alert($message, $context);
61: }
62:
63: public static function c($message, array $context = array())
64: {
65: self::getInstance()->critical($message, $context);
66: }
67:
68: public static function e($message, array $context = array())
69: {
70: self::getInstance()->error($message, $context);
71: }
72:
73: public static function w($message, array $context = array())
74: {
75: self::getInstance()->warning($message, $context);
76: }
77:
78: public static function n($message, array $context = array())
79: {
80: self::getInstance()->notice($message, $context);
81: }
82:
83: public static function i($message, array $context = array())
84: {
85: self::getInstance()->info($message, $context);
86: }
87:
88: public static function d($message, array $context = array())
89: {
90: self::getInstance()->debug($message, $context);
91: }
92:
93:
94: }