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

Breadcrumb

  1. Drupal Core 11.1.x

StreamLogWriter.php

Namespace

OpenTelemetry\API\Behavior\Internal\LogWriter

File

vendor/open-telemetry/api/Behavior/Internal/LogWriter/StreamLogWriter.php

View source
<?php

declare (strict_types=1);
namespace OpenTelemetry\API\Behavior\Internal\LogWriter;

class StreamLogWriter implements LogWriterInterface {
    private $stream;
    public function __construct(string $destination) {
        $stream = fopen($destination, 'a');
        if ($stream) {
            $this->stream = $stream;
        }
        else {
            throw new \RuntimeException(sprintf('Unable to open %s for writing', $destination));
        }
    }
    public function write($level, string $message, array $context) : void {
        fwrite($this->stream, Formatter::format($level, $message, $context));
    }

}

Classes

Title Deprecated Summary
StreamLogWriter
RSS feed
Powered by Drupal