Skip to content

Commit 351a30b

Browse files
authored
deprecate event logger (#1466)
The event logger was a Development-status component of the logging signal. It has been removed in favour of adding emitEvent to the logger interface, see open-telemetry/opentelemetry-specification#4319
1 parent a860bd4 commit 351a30b

8 files changed

+26
-1
lines changed

Globals.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public static function loggerProvider(): LoggerProviderInterface
5858
return Context::getCurrent()->get(ContextKeys::loggerProvider()) ?? self::globals()->loggerProvider;
5959
}
6060

61+
/**
62+
* @deprecated
63+
* @phan-suppress PhanDeprecatedFunction
64+
*/
6165
public static function eventLoggerProvider(): EventLoggerProviderInterface
6266
{
6367
return Context::getCurrent()->get(ContextKeys::eventLoggerProvider()) ?? self::globals()->eventLoggerProvider;
@@ -76,7 +80,7 @@ public static function registerInitializer(Closure $initializer): void
7680
}
7781

7882
/**
79-
* @phan-suppress PhanTypeMismatchReturnNullable
83+
* @phan-suppress PhanTypeMismatchReturnNullable,PhanDeprecatedFunction
8084
*/
8185
private static function globals(): self
8286
{

Instrumentation/CachedInstrumentation.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public function logger(): LoggerInterface
6868

6969
return $this->loggers[$loggerProvider] ??= $loggerProvider->getLogger($this->name, $this->version, $this->schemaUrl, $this->attributes);
7070
}
71+
72+
/**
73+
* @deprecated
74+
* @phan-suppress PhanDeprecatedFunction
75+
*/
7176
public function eventLogger(): EventLoggerInterface
7277
{
7378
$eventLoggerProvider = Globals::eventLoggerProvider();

Instrumentation/Configurator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static function create(): Configurator
4646

4747
/**
4848
* Creates a configurator that uses noop instances for not configured values.
49+
* @phan-suppress PhanDeprecatedFunction
4950
*/
5051
public static function createNoop(): Configurator
5152
{
@@ -63,6 +64,9 @@ public function activate(): ScopeInterface
6364
return $this->storeInContext()->activate();
6465
}
6566

67+
/**
68+
* @phan-suppress PhanDeprecatedFunction
69+
*/
6670
public function storeInContext(?ContextInterface $context = null): ContextInterface
6771
{
6872
$context ??= Context::getCurrent();
@@ -118,6 +122,9 @@ public function withLoggerProvider(?LoggerProviderInterface $loggerProvider): Co
118122
return $self;
119123
}
120124

125+
/**
126+
* @deprecated
127+
*/
121128
public function withEventLoggerProvider(?EventLoggerProviderInterface $eventLoggerProvider): Configurator
122129
{
123130
$self = clone $this;

Instrumentation/ContextKeys.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static function loggerProvider(): ContextKeyInterface
5858
}
5959

6060
/**
61+
* @deprecated
6162
* @return ContextKeyInterface<EventLoggerProviderInterface>
6263
*/
6364
public static function eventLoggerProvider(): ContextKeyInterface

Logs/EventLoggerInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use OpenTelemetry\Context\ContextInterface;
88

99
/**
10+
* @deprecated
1011
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/event-api.md#events-api-interface
1112
*/
1213
interface EventLoggerInterface

Logs/EventLoggerProviderInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace OpenTelemetry\API\Logs;
66

77
/**
8+
* @deprecated
89
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.32.0/specification/logs/event-api.md#get-an-eventlogger
910
*/
1011
interface EventLoggerProviderInterface

Logs/NoopEventLogger.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use OpenTelemetry\Context\ContextInterface;
88

9+
/**
10+
* @phan-suppress PhanDeprecatedInterface
11+
*/
912
class NoopEventLogger implements EventLoggerInterface
1013
{
1114
public static function instance(): self

Logs/NoopEventLoggerProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace OpenTelemetry\API\Logs;
66

7+
/**
8+
* @phan-suppress PhanDeprecatedInterface
9+
*/
710
class NoopEventLoggerProvider implements EventLoggerProviderInterface
811
{
912
public static function getInstance(): self

0 commit comments

Comments
 (0)