Skip to content

feat(Logs): allow configuration of logging levels #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[Python - Logging Levels]:https://docs.python.org/3/library/logging.html#levels
# Stax SDK for Python
`staxapp` is the [Stax](https://stax.io) Software Development Kit (SDK) for Python, allowing users to interact with the Stax platform.

[![codecov](https://codecov.io/gh/stax-labs/lib-stax-python-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/stax-labs/lib-stax-python-sdk)
![build](https://github.com/stax-labs/lib-stax-python-sdk/workflows/build/badge.svg)
![deploy](https://github.com/stax-labs/lib-stax-python-sdk/workflows/deploy/badge.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/staxapp)

## Authentication
In order to use the Stax SDK for Python, you will need a valid [Stax API Token](https://www.stax.io/developer/api-tokens/).

Expand All @@ -31,6 +33,21 @@ Allows configuration of the threshold to when the Auth library should re-cache t
export TOKEN_EXPIRY_THRESHOLD_IN_MINS=2 # Type: Integer representing minutes
~~~

##### Logging levels

As the logging levels are set on the import of the `Config` module, the below configuration is available on the presense of following environment variables:

- LOG_LEVEL: Default logger level

Value of environment variables should match [Python - Logging Levels]

Example:
Changing the logging from `INFO` to `DEBUG`
~~~bash
export LOG_LEVEL=DEBUG
python run_example.py
~~~

## Usage

### Read Accounts
Expand Down
2 changes: 1 addition & 1 deletion staxapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import staxapp
from staxapp.exceptions import ApiException

logging.getLogger().setLevel(logging.DEBUG)
logging.getLogger().setLevel(os.environ.get("LOG_LEVEL", logging.INFO))


class Config:
Expand Down