TrueAsync\LogSeverity

(PHP 8.6+, true_async_server 0.6+)

Enum of server logging levels. The backing values correspond to OpenTelemetry Logs Data Model SeverityNumber (1..24); a stable subset is exposed.

php
namespace TrueAsync;

enum LogSeverity: int
{
    case OFF   = 0;
    case DEBUG = 5;
    case INFO  = 9;
    case WARN  = 13;
    case ERROR = 17;
}
CaseOTel valueContents
OFF0nothing
DEBUG5tracing, H3 packet trace, etc.
INFO9server lifecycle (start/stop), bind retries
WARN13TLS handshake fail, peer reset, absorbed exceptions
ERROR17listener bind failed, hard protocol errors

TRACE and FATAL are intentionally absent. TRACE is unused; FATAL is delivered via zend_error_noreturn(E_ERROR), which already terminates the process.

Usage

The logger is disabled by default. To enable it, you need both:

  1. A severity other than OFF.
  2. A sink stream via HttpServerConfig::setLogStream().
php
use TrueAsync\HttpServerConfig;
use TrueAsync\LogSeverity;

$config
    ->setLogSeverity(LogSeverity::INFO)
    ->setLogStream(STDERR);

Severity is fixed at start — runtime changes are not supported (single-threaded lock-free model).

What you hear at each level

php
// production
$config->setLogSeverity(LogSeverity::WARN);

// staging / debug instability
$config->setLogSeverity(LogSeverity::INFO);

// deep debug
$config->setLogSeverity(LogSeverity::DEBUG);

DEBUG also enables verbose tracing of HTTP/3 packets and other internal flows — useful for diagnostics, but it adds CPU/IO overhead.

See also