1 | <?php |
||
19 | class MonologBuilder implements LoggerBuilderInterface |
||
20 | { |
||
21 | |||
22 | protected $loggerName = 'feed-io'; |
||
23 | |||
24 | protected $handlersConfig = [ |
||
25 | [ |
||
26 | 'class' => 'Monolog\Handler\StreamHandler', |
||
27 | 'params' => ['php://stdout', Logger::DEBUG], |
||
28 | ], |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * @param array $config |
||
33 | */ |
||
34 | 7 | public function __construct(array $config = []) |
|
40 | |||
41 | /** |
||
42 | * This method MUST return a valid PSR3 logger |
||
43 | * @return \Monolog\Logger |
||
44 | */ |
||
45 | 1 | public function getLogger() |
|
56 | |||
57 | /** |
||
58 | * @param string $class |
||
59 | * @param array $params |
||
60 | * @return Monolog\Handler\HandlerInterface |
||
61 | */ |
||
62 | 3 | public function newHandler($class, array $params = []) |
|
63 | { |
||
64 | 3 | $reflection = new \ReflectionClass($class); |
|
65 | |||
66 | 3 | if ( ! $reflection->implementsInterface('Monolog\Handler\HandlerInterface') ) { |
|
67 | 1 | throw new \InvalidArgumentException(); |
|
68 | } |
||
69 | |||
70 | 2 | return $reflection->newInstanceArgs($params); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * This method MUST return the name of the main class |
||
75 | * @return string |
||
76 | */ |
||
77 | 1 | public function getMainClassName() |
|
81 | |||
82 | /** |
||
83 | * This method MUST return the name of the package name |
||
84 | * @return string |
||
85 | */ |
||
86 | 1 | public function getPackageName() |
|
90 | |||
91 | } |
||
92 |