Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / http-kernel / Tests / Logger.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests;
13
14 use Psr\Log\LoggerInterface;
15
16 class Logger implements LoggerInterface
17 {
18     protected $logs;
19
20     public function __construct()
21     {
22         $this->clear();
23     }
24
25     public function getLogs($level = false)
26     {
27         return false === $level ? $this->logs : $this->logs[$level];
28     }
29
30     public function clear()
31     {
32         $this->logs = array(
33             'emergency' => array(),
34             'alert' => array(),
35             'critical' => array(),
36             'error' => array(),
37             'warning' => array(),
38             'notice' => array(),
39             'info' => array(),
40             'debug' => array(),
41         );
42     }
43
44     public function log($level, $message, array $context = array())
45     {
46         $this->logs[$level][] = $message;
47     }
48
49     public function emergency($message, array $context = array())
50     {
51         $this->log('emergency', $message, $context);
52     }
53
54     public function alert($message, array $context = array())
55     {
56         $this->log('alert', $message, $context);
57     }
58
59     public function critical($message, array $context = array())
60     {
61         $this->log('critical', $message, $context);
62     }
63
64     public function error($message, array $context = array())
65     {
66         $this->log('error', $message, $context);
67     }
68
69     public function warning($message, array $context = array())
70     {
71         $this->log('warning', $message, $context);
72     }
73
74     public function notice($message, array $context = array())
75     {
76         $this->log('notice', $message, $context);
77     }
78
79     public function info($message, array $context = array())
80     {
81         $this->log('info', $message, $context);
82     }
83
84     public function debug($message, array $context = array())
85     {
86         $this->log('debug', $message, $context);
87     }
88 }