HelPHP

Logs

The log line of every component of the service, in one place.

Three classes write logs (the server, the bridge, the hub) and they were doing it three slightly different ways: only the server caught an exception thrown by its sink, only the server checked that the instance really had a log file. A callback is application code; if it throws, the loop must keep running, and the same must hold wherever the line is produced.

The sink exists because the last mile is not the same for everyone: the runner routes the line to its own file or to stderr, and a test silences the service it forks. Without a sink the line goes to Error::log(), which is what a plain instance expects.

The line is scrubbed here, once: a logger is the last place where an OID, a cookie or a key can be copied by an exception message.

Tags
see

Server, Bridge, Hub

Table of Contents

Methods

add_log_sink()  : void
Adds a destination. A sink that throws is reported and skipped: a logger must never be the reason a connection dies.
has_log_sinks()  : bool

Methods

add_log_sink()

Adds a destination. A sink that throws is reported and skipped: a logger must never be the reason a connection dies.

public add_log_sink(mixed $callback) : void
Parameters
$callback : mixed

has_log_sinks()

public has_log_sinks() : bool
Return values
bool —

True when the lines go to an application sink rather than the instance log.

On this page

Search results