> ## Documentation Index
> Fetch the complete documentation index at: https://docs.westyx.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Rust SDK - Logging

> tracing spans and events, the startup summary, sync omission warnings, and what the SDK never records.

The SDK reports through the [`tracing`](https://docs.rs/tracing) facade and installs no subscriber of its own - the convention for a library, which leaves the choice of output to the application. Until your application installs one, nothing is printed.

```rust theme={null}
tracing_subscriber::fmt()
    .with_max_level(tracing::Level::INFO)
    .init();
```

## The startup summary

Once `create` has synced, one `INFO` event names what the first sync delivered - never a value:

```text theme={null}
INFO nexus.create{endpoint="blue-ocean-a5rx7.westyx.dev" key_type="sk"}: Nexus client ready
     endpoint=blue-ocean-a5rx7.westyx.dev key_type="sk" ttl_secs=60
     configs=database.url, server.port secrets=DB_PASSWORD, STRIPE_KEY flags=checkout.v2
```

Each list is sorted and holds at most 50 names, followed by `+N more`. It answers the first question of a misbehaving deployment - did the configuration I expect actually arrive? - without anyone reading a value.

With no subscriber installed, set `WESTYX_NEXUS_LOG_STARTUP=1` (`westyx_nexus::LOG_STARTUP_ENV`) to have the same summary written to stderr as one line:

```text theme={null}
westyx-nexus: client loaded configs=[database.url, server.port] secrets=[DB_PASSWORD, STRIPE_KEY] flags=[checkout.v2]
```

With a subscriber installed the variable adds nothing; the event above already carries the summary.

## Resources the server did not deliver

The server leaves out a secret that has no value and a config whose secret reference does not resolve, and says so in the sync response. Each new omission is logged once as a `WARN` event with `code`, `resource_type`, `key`, `secret` and `detail` fields - not again on every poll - and the current list is always available from `client.sync_errors()`. Set `log_sync_errors: Some(false)` in `NexusConfig` to keep the list without the warnings.

## What is logged

| Level | Event | When |
| - | - | - |
| `INFO` | `Nexus client ready` | The startup summary, once `create` has synced |
| `INFO` | `WIF session established` / `developer WIF session installed` | After a session exchange, or a developer session read |
| `INFO` | `SSE stream connected` | A stream connection was accepted |
| `DEBUG` | `sync applied` / `sync: 304 Not Modified` | After every sync, with the counts it applied |
| `WARN` | `the server did not deliver a resource` | Once per new omission |
| `WARN` | `the environment is switched off in the Nexus console; serving the cached snapshot` | Once, until a sync succeeds again |
| `WARN` | `WIF refresh failed; the current session is used until it expires` | A refresh failed while the session was still valid |
| `WARN` | `background sync failed; serving the cached snapshot` | A TTL refresh failed |
| `WARN` | `SSE stream disconnected` / `falling back to TTL polling after repeated SSE failures` | The stream's reconnect path |
| `WARN` | `billing overdue (HTTP 402); backing the background refresh off` | A 402 |

Spans wrap `create`, every sync (with its `trigger`), the session refresh and the write and A/B calls.

## What is never recorded

No span field or event carries a secret value, an API key, a session token or a workload OIDC token. Secret key names do appear - the startup summary lists them, and an omission warning names the key it is about - so a line can say which secret it concerns. A permanent test drives every path that touches secret material through a capturing subscriber at `TRACE` and fails if a value or a credential appears anywhere in the output.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.