Plop
A simple logging library for PHP
IndirectLoggerAbstract.php
1 <?php
2 /*
3  This file is part of Plop, a simple logging library for PHP.
4 
5  Copyright © 2010-2014 François Poirotte
6 
7  Plop is free software: you can redistribute it and/or modify
8  it under the terms of the GNU 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  Plop 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  You should have received a copy of the GNU General Public License
18  along with Plop. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 namespace Plop;
22 
34 abstract class IndirectLoggerAbstract extends LoggerAbstract
35 {
37  public function log(
38  $level,
39  $msg,
40  array $args = array(),
41  \Exception $exception = null
42  ) {
43  $logger = $this->getIndirectLogger();
44  $logger->log($level, $msg, $args, $exception);
45  return $this;
46  }
47 
49  public function getLevel()
50  {
51  return $this->getIndirectLogger()->getLevel();
52  }
53 
55  public function setLevel($level)
56  {
57  $logger = $this->getIndirectLogger();
58  $logger->setLevel($level);
59  return $this;
60  }
61 
63  public function isEnabledFor($level)
64  {
65  return $this->getIndirectLogger()->isEnabledFor($level);
66  }
67 
69  public function getNamespace()
70  {
71  return $this->getIndirectLogger()->getNamespace();
72  }
73 
75  public function getClass()
76  {
77  return $this->getIndirectLogger()->getClass();
78  }
79 
81  public function getMethod()
82  {
83  return $this->getIndirectLogger()->getMethod();
84  }
85 
87  public function getRecordFactory()
88  {
89  return $this->getIndirectLogger()->getRecordFactory();
90  }
91 
93  public function setRecordFactory(\Plop\RecordFactoryInterface $factory)
94  {
95  $logger = $this->getIndirectLogger();
96  $logger->setRecordFactory($factory);
97  return $this;
98  }
99 
101  public function getHandlers()
102  {
103  return $this->getIndirectLogger()->getHandlers();
104  }
105 
107  public function setHandlers(\Plop\HandlersCollectionAbstract $handlers)
108  {
109  $logger = $this->getIndirectLogger();
110  $logger->setHandlers($handlers);
111  return $this;
112  }
113 
115  public function getFilters()
116  {
117  return $this->getIndirectLogger()->getFilters();
118  }
119 
121  public function setFilters(\Plop\FiltersCollectionAbstract $filters)
122  {
123  $logger = $this->getIndirectLogger();
124  $logger->setFilters($filters);
125  return $this;
126  }
127 
135  abstract protected function getIndirectLogger();
136 }
log($level, $msg, array $args=array(),\Exception $exception=null)
An interface for a factory that produces instances that implement the Plop::RecordInterface interface...
An abstract class that can be used as a base to create new loggers.
Abstract class for a collection of filters.
An abstract class that can be used to proxy logging calls to an actual logger.
setFilters(\Plop\FiltersCollectionAbstract $filters)
setRecordFactory(\Plop\RecordFactoryInterface $factory)
This exception is thrown by Plop whenever a problem is detected.
Definition: Exception.php:30
Interface for a collection of handlers.
setHandlers(\Plop\HandlersCollectionAbstract $handlers)