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

Breadcrumb

  1. Drupal Core 11.1.x

LoggerHolder.php

Namespace

OpenTelemetry\API

File

vendor/open-telemetry/api/LoggerHolder.php

View source
<?php

declare (strict_types=1);
namespace OpenTelemetry\API;

use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
final class LoggerHolder {
    private static ?LoggerInterface $logger = null;
    
    /**
     * This constructor is a temporary solution to ease the setup of the logger with DI libraries
     */
    public function __construct(?LoggerInterface $logger = null) {
        self::$logger = $logger;
    }
    
    /**
     * @suppress PhanTypeMismatchReturnNullable
     * @internal
     */
    public static function get() : ?LoggerInterface {
        return self::$logger;
    }
    public static function set(?LoggerInterface $logger) : void {
        self::$logger = $logger;
    }
    public static function isSet() : bool {
        return null !== self::$logger;
    }
    
    /**
     * @internal
     */
    public static function unset() : void {
        self::$logger = null;
    }
    
    /**
     * Disable psr-3 logging
     * @internal
     */
    public static function disable() : void {
        self::$logger = new NullLogger();
    }

}

Classes

Title Deprecated Summary
LoggerHolder

API Navigation

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