1 | <?php |
||
13 | final class NewRelicLogger extends AbstractLogger implements LoggerInterface |
||
14 | { |
||
15 | use ExceptionExtractorTrait; |
||
16 | use LevelValidatorTrait; |
||
17 | use MessageValidatorTrait; |
||
18 | use MessageInterpolationTrait; |
||
19 | |||
20 | /** |
||
21 | * NewRelic Agent implementation. |
||
22 | * |
||
23 | * @var Agent |
||
24 | */ |
||
25 | private $newRelicAgent; |
||
26 | |||
27 | /** |
||
28 | * Array of log levels which should be reported to new relic. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | private $observedLevels = []; |
||
33 | |||
34 | /** |
||
35 | * Default log levels to report. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | const DEFAULT_OBSERVED_LEVELS = [ |
||
40 | LogLevel::EMERGENCY, |
||
41 | LogLevel::CRITICAL, |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * Construct a new instance of the logger. |
||
46 | * |
||
47 | * @param Agent $newRelicAgent NewRelic Agent implementation. |
||
48 | * @param array $observedLevels Array of log levels which should be reported to new relic. |
||
49 | */ |
||
50 | public function __construct(Agent $newRelicAgent, array $observedLevels = self::DEFAULT_OBSERVED_LEVELS) |
||
55 | |||
56 | /** |
||
57 | * Logs with an arbitrary level. |
||
58 | * |
||
59 | * @param string $level A valid RFC 5424 log level. |
||
60 | * @param string $message The base log message. |
||
61 | * @param array $context Any extraneous information that does not fit well in a string. |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | public function log($level, $message, array $context = [])//@codingStandardsIgnoreLine Interface does not define type-hints or return |
||
80 | |||
81 | private function addCustomNewRelicParameters(array $context) |
||
91 | } |
||
92 |