# Logging & Tracing
The crate exposes optional tracing integration behind the `telemetry` feature flag. When enabled,
`PortClient` emits `tracing` spans for every HTTP request without leaking authentication headers.
## Enabling Tracing
```toml
[dependencies]
port-sdk = { version = "0.1", features = ["telemetry"] }
```
```rust
use port_sdk::PortClient;
let client = PortClient::builder()
.from_env()?
.enable_tracing(true)
.build()?;
```
Set `PORT_TRACING_ENABLED=1` in your environment to turn on tracing automatically when using
`PortClient::from_env`.
## Safe Logging Practices
- The SDK never logs bearer tokens or request bodies.
- Only method, URL, and status code are recorded. Override the tracing subscriber in your
application if you need more context.
- When writing custom logs, prefer the token provider interface rather than inspecting raw headers.
- Keep `.env` files out of version control; they may contain production credentials.