final class Logger extends AbstractLogger (View source)

CNR Logger

Formatting only — the destination belongs to the sink the base class writes to. Do not add a log() override here; it is final upstream.

Methods

__construct(LogSinkInterface $sink = new EchoSink())

No description

string
format(string $post, ResponseInterface $response, string|null $error = null)

Build the CNR debug record: command, POST body, optional transport error and the plain response, joined by newlines.

void
log(string $post, ResponseInterface $response, string|null $error = null)

Format the record, then hand it to the sink. The whole implementation of the contract — see the class docblock for why it may not be overridden.

Details

__construct(LogSinkInterface $sink = new EchoSink())

No description

Parameters

LogSinkInterface $sink

Destination for formatted records; defaults to standard output

string format(string $post, ResponseInterface $response, string|null $error = null)

Build the CNR debug record: command, POST body, optional transport error and the plain response, joined by newlines.

Parameters

string $post

Post request data in string format (already masked)

ResponseInterface $response
string|null $error

Return Value

string

final void log(string $post, ResponseInterface $response, string|null $error = null)

Format the record, then hand it to the sink. The whole implementation of the contract — see the class docblock for why it may not be overridden.

Parameters

string $post

Post request data in string format (already masked)

ResponseInterface $response
string|null $error

Return Value

void