Skip to main content
The PHP SDK reports what it is doing through the PSR-3 LoggerInterface. Pass any PSR-3 implementation as NexusConfig::$logger - Monolog, Laravel’s logger, Symfony’s autowired LoggerInterface. With $logger left null (the default), the SDK is silent - the PSR-3 convention for a library - except for the startup summary when you ask for it.

Configuration

What the SDK logs

Structured, not interpolated

Messages are stable strings; values go in the PSR-3 $context array:
That is what lets a log aggregator group every sync together and query the counts. A message with its values interpolated into the text is a unique string per occurrence and cannot be grouped or queried at all.

The startup summary

Once create has synced, the logger receives one info record naming what the first sync delivered - never a value:
Each list is sorted and holds at most 50 names, followed by a +N more entry. It answers the first question of a misbehaving deployment - did the configuration I expect actually arrive? - without anyone reading a value. A client created without a logger writes the same summary as one line when WESTYX_NEXUS_LOG_STARTUP=1 is set:
On the CLI it goes to stderr. Under PHP-FPM, where the STDERR constant does not exist, it goes through error_log() to the configured error log - in the official php:*-fpm images, the container’s stderr. With a logger configured the variable adds nothing; the record above already carries it. In Laravel the summary reaches the application log with no setting at all.

Secret values never appear in log output

No secret value is logged, and neither is an API key, a session token or an OIDC token. Key names are, so a line can say which secret it is about: the startup summary lists them, and an omission warning names the key the server did not deliver. This is enforced, not merely intended: a permanent test drives a sync carrying both a text-type and a file-type secret, and a write, through a capturing logger at the most verbose level, and fails if any secret value or the API key appears anywhere in the output.

A failing logger is contained

A logger that itself throws - a Monolog handler on a full disk, a down syslog target - cannot take an SDK call down with it. Diagnostic writes are contained, so a logging fault degrades logging alone rather than failing the config, secret or WIF operation it was reporting on.

Monolog example

Monolog is the most common PSR-3 implementation in PHP:
To route SDK logs to a dedicated channel:

Symfony Dependency Injection

Build the client in a factory service, and register the client through it:

Laravel

Nothing to do: the service provider takes the logger from the container, so SDK output reaches your application log automatically. Set NEXUS_LOG_CHANNEL to keep it on its own channel:
Add that channel to config/logging.php:

Silencing SDK logs

If you want the SDK to produce no output at all, pass a NullLogger:
NullLogger ships with psr/log, which the SDK already requires, so there is no extra dependency. Alternatively, leave $logger as null (the default) - the SDK omits all logging in that case.