LoggerInterface
interface LoggerInterface (View source)
Common Logger Interface
Two methods, and the split between them is the point: {\CNIC\format()} is the
part that varies per brand and it returns the record, {\CNIC\log()} only
decides where the record goes. Do not collapse them back into a single
echoing log() — see the logger-seam entry in docs/agents/architecture.md.
Extend {\CNIC\AbstractLogger} to implement format() and inherit the sink
wiring; implement this interface directly only if you want to own the
destination too.
Methods
Build the debug record for the given request/response pair.
Write the debug record for the given request/response pair.
Details
string
format(string $post, ResponseInterface $response, string|null $error = null)
Build the debug record for the given request/response pair.
Callers get the record as a string; nothing is written. Both arguments are
already masked when they arrive — the response masks its own stored
command ({\CNIC\AbstractResponse::sanitizeCommand()}, so getCommand() and
getCommandPlain() are safe) and the client passes a secured POST body —
so implementations must not undo that. The exception is
{\CNIC\ResponseInterface::getContext()}, which is caller-supplied and
deliberately untouched: an implementation logging it masks it itself.
void
log(string $post, ResponseInterface $response, string|null $error = null)
Write the debug record for the given request/response pair.