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