{"record":{"id":"73ac9b273a09fbef","repo":"Seldaek/monolog","slug":"composer-package-graylog2-gelf-php-is-required-to","errorCode":null,"errorMessage":"Composer package graylog2/gelf-php is required to use Monolog's GelfMessageFormatter","messagePattern":"Composer package graylog2/gelf-php is required to use Monolog's GelfMessageFormatter","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Formatter/GelfMessageFormatter.php","lineNumber":72,"sourceCode":"        return match ($level) {\n            Level::Debug     => 7,\n            Level::Info      => 6,\n            Level::Notice    => 5,\n            Level::Warning   => 4,\n            Level::Error     => 3,\n            Level::Critical  => 2,\n            Level::Alert     => 1,\n            Level::Emergency => 0,\n        };\n    }\n\n    /**\n     * @throws \\RuntimeException\n     */\n    public function __construct(?string $systemName = null, ?string $extraPrefix = null, string $contextPrefix = 'ctxt_', ?int $maxLength = null)\n    {\n        if (!class_exists(Message::class)) {\n            throw new \\RuntimeException('Composer package graylog2/gelf-php is required to use Monolog\\'s GelfMessageFormatter');\n        }\n\n        parent::__construct('U.u');\n\n        $this->systemName = (null === $systemName || $systemName === '') ? (string) gethostname() : $systemName;\n\n        $this->extraPrefix = null === $extraPrefix ? '' : $extraPrefix;\n        $this->contextPrefix = $contextPrefix;\n        $this->maxLength = null === $maxLength ? self::DEFAULT_MAX_LENGTH : $maxLength;\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function format(LogRecord $record): Message\n    {\n        $context = $extra = [];\n        if ($record->context !== []) {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Formatter/GelfMessageFormatter.php#L54-L90","documentation":"Error \"Composer package graylog2/gelf-php is required to use Monolog's GelfMessageFormatter\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Formatter/GelfMessageFormatter.php:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}