mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
As discussed in https://github.com/php/frankenphp/discussions/1961, there is no real way to pass a severity/level to any log handler offered by PHP that would make it to the FrankenPHP layer. This new function allows applications embedding FrankenPHP to integrate PHP logging into the application itself, thus offering a more streamlined experience. --------- Co-authored-by: Quentin Burgess <qutn.burgess@gmail.com> Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
/** @generate-class-entries */
|
|
|
|
/** @var int */
|
|
const FRANKENPHP_LOG_LEVEL_DEBUG = -4;
|
|
|
|
/** @var int */
|
|
const FRANKENPHP_LOG_LEVEL_INFO = 0;
|
|
|
|
/** @var int */
|
|
const FRANKENPHP_LOG_LEVEL_WARN = 4;
|
|
|
|
/** @var int */
|
|
const FRANKENPHP_LOG_LEVEL_ERROR = 8;
|
|
|
|
function frankenphp_handle_request(callable $callback): bool {}
|
|
|
|
function headers_send(int $status = 200): int {}
|
|
|
|
function frankenphp_finish_request(): bool {}
|
|
|
|
/**
|
|
* @alias frankenphp_finish_request
|
|
*/
|
|
function fastcgi_finish_request(): bool {}
|
|
|
|
function frankenphp_request_headers(): array {}
|
|
|
|
/**
|
|
* @alias frankenphp_request_headers
|
|
*/
|
|
function apache_request_headers(): array {}
|
|
|
|
/**
|
|
* @alias frankenphp_request_headers
|
|
*/
|
|
function getallheaders(): array {}
|
|
|
|
function frankenphp_response_headers(): array|bool {}
|
|
|
|
/**
|
|
* @alias frankenphp_response_headers
|
|
*/
|
|
function apache_response_headers(): array|bool {}
|
|
|
|
/**
|
|
* @param string|string[] $topics
|
|
*/
|
|
function mercure_publish(string|array $topics, string $data = '', bool $private = false, ?string $id = null, ?string $type = null, ?int $retry = null): string {}
|
|
|
|
/**
|
|
* @param int $level The importance or severity of a log event. The higher the level, the more important or severe the event. For more details, see: https://pkg.go.dev/log/slog#Level
|
|
* array<string, any> $context Values of the array will be converted to the corresponding Go type (if supported by FrankenPHP) and added to the context of the structured logs using https://pkg.go.dev/log/slog#Attr
|
|
*/
|
|
function frankenphp_log(string $message, int $level = 0, array $context = []): void {}
|