ttrss/vendor/open-telemetry/api/Logs/EventLogger.php

27 lines
602 B
PHP
Raw Normal View History

2023-10-20 14:12:29 +00:00
<?php
declare(strict_types=1);
namespace OpenTelemetry\API\Logs;
class EventLogger implements EventLoggerInterface
{
private LoggerInterface $logger;
private string $domain;
public function __construct(LoggerInterface $logger, string $domain)
{
$this->logger = $logger;
$this->domain = $domain;
}
public function logEvent(string $eventName, LogRecord $logRecord): void
{
$logRecord->setAttributes([
'event.name' => $eventName,
'event.domain' => $this->domain,
]);
$this->logger->emit($logRecord);
}
}