Skip to content

Logging

The SDK uses the standard library logger named rtls_sdk. To see request and response activity:

import logging
logging.getLogger("rtls_sdk").setLevel(logging.DEBUG)

What gets logged

  • DEBUG — every request (method, URL, redacted headers) and every response (status, redacted body when JSON).
  • WARNING — sub-call failures during compound flows (context.load() partial state, etc.).
  • No INFO chatter by default. The SDK assumes the caller has its own application logger and doesn't need extra noise.

Redaction is mandatory

Every log record is filtered through the SDK's redaction layer before emission. There is no opt-out flag. Redacted:

  • Header keys: X-User-Token, X-User-Email, X-User-Refresh-Token, Authorization, Cookie, Set-Cookie.
  • Body keys (recursively, case-insensitive): password, token, refresh_token, access_token, client_secret, api_key.

If you want unredacted payloads (e.g. debugging a server-side bug), install your own httpx event hook on a separate httpx.Client and hand that client to RtlsClient(http_client=...). The SDK only redacts records it emits; your hooks see raw payloads.

Adding a handler

import logging

handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s"))

sdk_logger = logging.getLogger("rtls_sdk")
sdk_logger.addHandler(handler)
sdk_logger.setLevel(logging.DEBUG)

Quieting it in tests

logging.getLogger("rtls_sdk").setLevel(logging.WARNING)

The SDK does not propagate DEBUG / INFO records up to the root logger unless you configure that explicitly. Mute it on a per-logger basis without affecting your application's logging.