anomaly / gallagher

The missing toolkit for extending Gallagher Command Centre, featuring a CLI, SQL interface, TUI and a Python idiomatic SDK
https://anomaly.github.io/gallagher/
MIT License
11 stars 2 forks source link

Integrate standard python logging across the library and applications to ease debugging #42

Open devraj opened 3 months ago

devraj commented 3 months ago

Is your feature request related to a problem? Please describe. I should have started on this earlier but better late than never, this request is to integrate logging to ease debugging across the library and application.

While we have unit testing across the SDK which ensures proper operation, there are now use cases where we have programatic and user interfaces e.g SQL and CLI/TUI.

In cases where we are building an adapter for shillelagh we comes across the need to enable logging as the interactive shell hides all error messages.

import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')

Describe the solution you'd like Where possible add logging.DEBUG messages so when the developer/user is running the library with verbose logging enabled they can see what is going on under the hood.

There are various lifecycle use cases where the order of operation matters, for example the _discover method should only be called one the environment variables with the API key is available to the environment.

Other examples are __config__ for endpoints are automatically populated upon the discovery running, and we need to validate that this has happened.

While this does not cause an error so to speak, it does cause the SDK to have unexpected behaviour and debug messages will assist in getting to the bottom of this quicker.

Describe alternatives you've considered NA

Additional context Please add this to the list of things that needs to be documented for developers of the SDK.