77use OpenTelemetry \API \Behavior \LogsMessagesTrait ;
88use OpenTelemetry \API \Logs \LoggerInterface ;
99use OpenTelemetry \API \Logs \LogRecord ;
10+ use OpenTelemetry \Context \ContextInterface ;
1011use OpenTelemetry \SDK \Common \Instrumentation \InstrumentationScopeInterface ;
1112use OpenTelemetry \SDK \Common \InstrumentationScope \Configurator ;
1213
13- /**
14- * Note that this logger class is deliberately NOT psr-3 compatible, per spec: "Note: this document defines a log
15- * backend API. The API is not intended to be called by application developers directly."
16- *
17- * @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md
18- */
1914class Logger implements LoggerInterface
2015{
2116 use LogsMessagesTrait;
@@ -33,6 +28,9 @@ public function __construct(
3328 $ this ->config = $ configurator ? $ configurator ->resolve ($ scope ) : LoggerConfig::default ();
3429 }
3530
31+ /**
32+ * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/api.md#emit-a-logrecord
33+ */
3634 public function emit (LogRecord $ logRecord ): void
3735 {
3836 //If a Logger is disabled, it MUST behave equivalently to No-op Logger.
@@ -52,12 +50,16 @@ public function emit(LogRecord $logRecord): void
5250 }
5351 }
5452
55- public function isEnabled (): bool
53+ /**
54+ * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/api.md#enabled
55+ */
56+ public function isEnabled (?ContextInterface $ context = null , ?int $ severityNumber = null ): bool
5657 {
5758 return $ this ->config ->isEnabled ();
5859 }
5960
6061 /**
62+ * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/sdk.md#loggerconfigurator
6163 * @param Configurator<LoggerConfig> $configurator
6264 */
6365 public function updateConfig (Configurator $ configurator ): void
0 commit comments