Skip to content

Conversation

@thomas6785
Copy link

Introduced logging to API calls to help debugging

  • Uses standard logging module.
  • Logs debug level messages for all calls to API methods and for all HTTP requests
  • Log messages include function arguments and return values
  • No handlers are created - that is the responsibility of the application using the package

To view logs for the test suite:
uv run pytest --log-file=log.log --log-level=DEBUG
and open log.log

This is something I have in my own copy of this SDK and found useful for recreating bugs in my tools. Log files are quite verbose but easily searchable.

@thomas6785 thomas6785 requested a review from a team as a code owner September 27, 2025 18:50
@thomas6785 thomas6785 requested review from lukemerrett and removed request for a team September 27, 2025 18:50
@Schnouki
Copy link

Hey @thomas6785, thanks for this contribution! It looks pretty good, but I'm not really sure this is actually something we want in our SDK. This feels to me like something that could live in a 3rd-party debugging lib, and could be then applied to this (or other libraries) through monkey-patching at runtime 🤔
Is this something you'd be interested in creating and maintaining?

@thomas6785
Copy link
Author

Hi @Schnouki , thanks for the reply.
I generally prefer to include log messages in production, not only debug, to help with recreating bugs encountered.
For an abundance of clarity, I might point out that the log messages do not go anywhere (neither console nor file) unless the application importing the SDK has set up log handlers.
It seems to me like this would make this pull helpful (or at least, harmless), but I will defer to your professional opinion.

Incidentally, there are a few other extensions I'm working on in my fork. For now I was intending on maintaining these for my own purposes in my own repo, but if you are interested:

  • CachedAPI: A drop-in replacement for the API class which caches return values
  • SyncedAPI: A drop-in replacement for the API class which uses the /sync/ endpoint to minimise API calls
  • oop_models.py: A set of models to wrap the existing dataclasses but allow dot syntax for API methods
    e.g. proj = task.get_project()

@goncalossilva
Copy link
Member

Hey @thomas6785, thanks for this!

I could be swayed, but I generally agree with @Schnouki in that it is best for something like this to be added externally as needed. Also, note that the session can be passed in. Can we hook into that and achieve the same result? If yes, that might just become a “recommended” way of achieving this. 🤔

@thomas6785 thomas6785 closed this Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants