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

Breadcrumb

  1. Drupal Core 11.1.x
  2. LogsMessagesTrait.php

trait LogsMessagesTrait

Hierarchy

  • trait \OpenTelemetry\API\Behavior\LogsMessagesTrait
23 files declare their use of LogsMessagesTrait
AttributesBuilder.php in vendor/open-telemetry/sdk/Common/Attribute/AttributesBuilder.php
AutoRootSpan.php in vendor/open-telemetry/sdk/Trace/AutoRootSpan.php
BatchLogRecordProcessor.php in vendor/open-telemetry/sdk/Logs/Processor/BatchLogRecordProcessor.php
BatchSpanProcessor.php in vendor/open-telemetry/sdk/Trace/SpanProcessor/BatchSpanProcessor.php
Configuration.php in vendor/open-telemetry/sdk/Common/Configuration/Configuration.php

... See full list

File

vendor/open-telemetry/api/Behavior/LogsMessagesTrait.php, line 10

Namespace

OpenTelemetry\API\Behavior
View source
trait LogsMessagesTrait {
    private static function shouldLog(string $level) : bool {
        return Logging::level($level) >= Logging::logLevel();
    }
    private static function doLog(string $level, string $message, array $context) : void {
        $writer = Logging::logWriter();
        if (self::shouldLog($level)) {
            $context['source'] = get_called_class();
            $writer->write($level, $message, $context);
        }
    }
    protected static function logDebug(string $message, array $context = []) : void {
        self::doLog(LogLevel::DEBUG, $message, $context);
    }
    protected static function logInfo(string $message, array $context = []) : void {
        self::doLog(LogLevel::INFO, $message, $context);
    }
    protected static function logNotice(string $message, array $context = []) : void {
        self::doLog(LogLevel::NOTICE, $message, $context);
    }
    protected static function logWarning(string $message, array $context = []) : void {
        self::doLog(LogLevel::WARNING, $message, $context);
    }
    protected static function logError(string $message, array $context = []) : void {
        self::doLog(LogLevel::ERROR, $message, $context);
    }

}

Members

Title Sort descending Modifiers Object type Summary
LogsMessagesTrait::doLog private static function
LogsMessagesTrait::logDebug protected static function
LogsMessagesTrait::logError protected static function
LogsMessagesTrait::logInfo protected static function
LogsMessagesTrait::logNotice protected static function
LogsMessagesTrait::logWarning protected static function
LogsMessagesTrait::shouldLog private static function

API Navigation

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