Skip to content

Add logging #6

Description

@xbt-a4224j

Proposal, feedback welcome!

  • Add slf4j logging on a io.github.premocloud.typesafe logger. DEBUG: one line per request with status, elapsed and request id, plus a line per retry and per connection failure (transport.py:73-94). TRACE: the wire in both directions — method, url, headers, body (_log_wire, client.ts:344-396). A tier below the references, since Spring Boot's default root level is INFO and theirs filter it out.

  • Nothing at INFO or above: neither reference has a WARN or ERROR call site, and failures already throw (TypeSafeApiException), which carries more than a log line would.

  • No TYPESAFE_LOG_LEVEL as in the reference impls: slf4j has no library-side level setting, and per the FAQ libraries "should let the end-user configure the logging environment". README should specify logging.level.io.github.premocloud.typesafe={DEBUG|TRACE}.

  • One redaction point, as with SensitiveHeadersFilter and redactHeaders, so no call site can leak. "***" as in python, set from SECRET_HEADERS plus the _is_secret "token"/"secret" check, since Builder.header lets a caller add one this SDK never anticipated.

Sample monitoring output:

#1
DEBUG io.github.premocloud.typesafe - req-1 <- 200 in 754ms (request req_01a0bc4f...)

#2
TRACE io.github.premocloud.typesafe - req-1 -> POST https://api.typesafe.ai/v1/systemone headers={Accept=application/json, Authorization=***, ...} body={"state":...}
DEBUG io.github.premocloud.typesafe - req-1 <- 200 in 649ms (request req_01a0bc4f...)
TRACE io.github.premocloud.typesafe - req-1 <- 200 headers={:status=200, x-typesafe-request-id=req_01a0bc4f..., ...} body={"model":"jev-1.13.0",...}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions