1 | <?php |
||
16 | final class MongoLogger extends AbstractLogger implements LoggerInterface |
||
17 | { |
||
18 | use ExceptionExtractorTrait; |
||
19 | use LevelValidatorTrait; |
||
20 | use MessageInterpolationTrait; |
||
21 | use MessageValidatorTrait; |
||
22 | |||
23 | /** |
||
24 | * Collection containing logs. |
||
25 | * |
||
26 | * @var Collection |
||
27 | */ |
||
28 | private $collection; |
||
29 | |||
30 | /** |
||
31 | * Create a new instance of MongoLogger. |
||
32 | * |
||
33 | * @param Collection $collection Mongo collection to which the logs should be written. |
||
34 | */ |
||
35 | public function __construct(Collection $collection) |
||
39 | |||
40 | /** |
||
41 | * Logs with an arbitrary level. |
||
42 | * |
||
43 | * @param string $level A valid RFC 5424 log level. |
||
44 | * @param string $message The base log message. |
||
45 | * @param array $context Any extraneous information that does not fit well in a string. |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | public function log($level, $message, array $context = [])//@codingStandardsIgnoreLine Ignore missing type hints |
||
62 | |||
63 | private function buildBasicDocument(string $level, string $message, array $context = []) |
||
71 | |||
72 | private function getExceptionData(array $context = []) |
||
81 | |||
82 | private function getNormalizeArray(array $array = []) |
||
91 | |||
92 | private function getNormalizedValue($value) |
||
104 | } |
||
105 |