1 | <?php |
||
21 | trait Logging |
||
22 | { |
||
23 | private static $global = null; |
||
24 | |||
25 | /** @var LoggerInterface */ |
||
26 | private $_logger = null; |
||
27 | |||
28 | public static function setGlobalLogger(LoggerInterface $logger) |
||
32 | |||
33 | /** |
||
34 | * @return LoggerInterface |
||
35 | */ |
||
36 | public function getLogger() : LoggerInterface |
||
37 | { |
||
38 | if ($this->_logger === null) { |
||
39 | $this->_logger = self::getGlobalLogger(); |
||
40 | } |
||
41 | |||
42 | return $this->_logger; |
||
43 | } |
||
44 | |||
45 | public function setLogger(LoggerInterface $logger) |
||
46 | { |
||
47 | $this->_logger = $logger; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return LoggerInterface |
||
52 | */ |
||
53 | public static function getGlobalLogger() |
||
61 | } |
||
62 |