Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

ExporterFactory.php

Same filename in this branch
  1. 11.1.x vendor/open-telemetry/sdk/Trace/ExporterFactory.php

Namespace

OpenTelemetry\SDK\Logs

File

vendor/open-telemetry/sdk/Logs/ExporterFactory.php

View source
<?php

declare (strict_types=1);
namespace OpenTelemetry\SDK\Logs;

use InvalidArgumentException;
use OpenTelemetry\SDK\Common\Configuration\Configuration;
use OpenTelemetry\SDK\Common\Configuration\Variables;
use OpenTelemetry\SDK\Logs\Exporter\NoopExporter;
use OpenTelemetry\SDK\Registry;
class ExporterFactory {
    public function create() : LogRecordExporterInterface {
        $exporters = Configuration::getList(Variables::OTEL_LOGS_EXPORTER);
        if (1 !== count($exporters)) {
            throw new InvalidArgumentException(sprintf('Configuration %s requires exactly 1 exporter', Variables::OTEL_LOGS_EXPORTER));
        }
        $exporter = $exporters[0];
        if ($exporter === 'none') {
            return new NoopExporter();
        }
        $factory = Registry::logRecordExporterFactory($exporter);
        return $factory->create();
    }

}

Classes

Title Deprecated Summary
ExporterFactory

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal