Skip to content

Commit 768c387

Browse files
authored
add Logger.Enabled event name parameter (#1632)
extra parameter added in spec 1.45.0, which is optional and development stability
1 parent 526b8eb commit 768c387

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

src/API/Logs/LateBindingLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function emit(LogRecord $logRecord): void
2222
($this->logger ??= ($this->factory)())->emit($logRecord);
2323
}
2424

25-
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null): bool
25+
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool
2626
{
2727
return true;
2828
}

src/API/Logs/LoggerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ public function emit(LogRecord $logRecord): void;
1414
* Determine if the logger is enabled. Instrumentation authors SHOULD call this method each time they
1515
* emit a LogRecord, to ensure they have the most up-to-date response.
1616
*/
17-
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null): bool;
17+
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool;
1818
}

src/API/Logs/NoopLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function log($level, $message, array $context = []): void
3232
{
3333
}
3434

35-
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null): bool
35+
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool
3636
{
3737
return false;
3838
}

src/SDK/Logs/LogRecordProcessorInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
use OpenTelemetry\Context\ContextInterface;
88
use OpenTelemetry\SDK\Common\Future\CancellationInterface;
99

10+
/**
11+
* @todo implement (optional) isEnabled: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.45.0/specification/logs/sdk.md#enabled-1
12+
*/
1013
interface LogRecordProcessorInterface
1114
{
1215
public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = null): void;

src/SDK/Logs/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function emit(LogRecord $logRecord): void
5353
/**
5454
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/api.md#enabled
5555
*/
56-
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null): bool
56+
public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool
5757
{
5858
return $this->config->isEnabled();
5959
}

0 commit comments

Comments
 (0)