Skip to content

Commit b4c7f44

Browse files
authored
feat(Logs): allow configuration of logging levels (#80)
* feat(Logs): allow configuration of logging levels * docs(README): add python logging levels reference
1 parent 708905e commit b4c7f44

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
[Python - Logging Levels]:https://docs.python.org/3/library/logging.html#levels
12
# Stax SDK for Python
23
`staxapp` is the [Stax](https://stax.io) Software Development Kit (SDK) for Python, allowing users to interact with the Stax platform.
34

45
[![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)
56
![build](https://github.com/stax-labs/lib-stax-python-sdk/workflows/build/badge.svg)
67
![deploy](https://github.com/stax-labs/lib-stax-python-sdk/workflows/deploy/badge.svg)
78
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/staxapp)
9+
810
## Authentication
911
In order to use the Stax SDK for Python, you will need a valid [Stax API Token](https://www.stax.io/developer/api-tokens/).
1012

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

36+
##### Logging levels
37+
38+
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:
39+
40+
- LOG_LEVEL: Default logger level
41+
42+
Value of environment variables should match [Python - Logging Levels]
43+
44+
Example:
45+
Changing the logging from `INFO` to `DEBUG`
46+
~~~bash
47+
export LOG_LEVEL=DEBUG
48+
python run_example.py
49+
~~~
50+
3451
## Usage
3552

3653
### Read Accounts

staxapp/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import staxapp
88
from staxapp.exceptions import ApiException
99

10-
logging.getLogger().setLevel(logging.DEBUG)
10+
logging.getLogger().setLevel(os.environ.get("LOG_LEVEL", logging.INFO))
1111

1212

1313
class Config:

0 commit comments

Comments
 (0)