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

Breadcrumb

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

class Formatter

Hierarchy

  • class \OpenTelemetry\API\Behavior\Internal\LogWriter\Formatter

Expanded class hierarchy of Formatter

7 string references to 'Formatter'
EntityField::buildOptionsForm in core/modules/views/src/Plugin/views/field/EntityField.php
Default option form that provides label widget that all fields should have.
FieldBlock::blockForm in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
FieldBlock::blockSubmit in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
FormatterHelper::getName in vendor/symfony/console/Helper/FormatterHelper.php
Returns the canonical name of this helper.
InitCommand::interact in vendor/composer/composer/src/Composer/Command/InitCommand.php
@inheritDoc

... See full list

File

vendor/open-telemetry/api/Behavior/Internal/LogWriter/Formatter.php, line 7

Namespace

OpenTelemetry\API\Behavior\Internal\LogWriter
View source
class Formatter {
    public static function format($level, string $message, array $context) : string {
        $exception = array_key_exists('exception', $context) && $context['exception'] instanceof \Throwable ? $context['exception'] : null;
        if ($exception) {
            $previous = $exception->getPrevious() ? $exception->getPrevious()
                ->getMessage() : '';
            $message = sprintf('OpenTelemetry: [%s] %s [exception] %s [previous] %s%s%s', $level, $message, $exception->getMessage(), $previous, PHP_EOL, $exception->getTraceAsString());
        }
        else {
            
            //get calling location, skipping over trait, formatter etc
            $caller = debug_backtrace()[3];
            
            /**
             * @psalm-suppress PossiblyNullArgument
             * @psalm-suppress PossiblyUndefinedArrayOffset
             */
            $message = sprintf('OpenTelemetry: [%s] %s in %s(%s)', $level, $message, $caller['file'], $caller['line']);
        }
        return $message;
    }

}

Members

Title Sort descending Modifiers Object type Summary
Formatter::format public static function
RSS feed
Powered by Drupal