File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 5
5
![ build] ( https://github.com/stax-labs/lib-stax-python-sdk/workflows/build/badge.svg )
6
6
![ deploy] ( https://github.com/stax-labs/lib-stax-python-sdk/workflows/deploy/badge.svg )
7
7
![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/staxapp )
8
+ ![ Python - Logging Levels] ( https://docs.python.org/3/library/logging.html#levels )
8
9
## Authentication
9
10
In order to use the Stax SDK for Python, you will need a valid [ Stax API Token] ( https://www.stax.io/developer/api-tokens/ ) .
10
11
@@ -31,6 +32,22 @@ Allows configuration of the threshold to when the Auth library should re-cache t
31
32
export TOKEN_EXPIRY_THRESHOLD_IN_MINS=2 # Type: Integer representing minutes
32
33
~~~
33
34
35
+ ##### Logging levels
36
+
37
+ 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:
38
+
39
+ - LOG_LEVEL: Default logger level
40
+ - LOG_LEVEL_BOTO3: ` boto3 ` logger level
41
+ - LOG_LEVEL_BOTOCORE: ` botocore ` logger level
42
+ - LOG_LEVEL_NOSE: ` nose ` logger level
43
+ - LOG_LEVEL_URLLIB3: ` urllib3 ` logger level
44
+
45
+ Example:
46
+ ~~~ bash
47
+ export LOG_LEVEL=INFO LOG_LEVEL_BOTO3=WARNING
48
+ python run_example.py
49
+ ~~~
50
+
34
51
## Usage
35
52
36
53
### Read Accounts
Original file line number Diff line number Diff line change 7
7
import staxapp
8
8
from staxapp .exceptions import ApiException
9
9
10
- logging .getLogger ().setLevel (logging .DEBUG )
11
- logging .getLogger ("boto3" ).setLevel (logging .WARNING )
12
- logging .getLogger ("botocore" ).setLevel (logging .WARNING )
13
- logging .getLogger ("nose" ).setLevel (logging .WARNING )
14
- logging .getLogger ("urllib3" ).setLevel (logging .WARNING )
10
+ logging .getLogger ().setLevel (os . environ . get ( "LOG_LEVEL" , logging .DEBUG ) )
11
+ logging .getLogger ("boto3" ).setLevel (os . environ . get ( "LOG_LEVEL_BOTO3" , logging .WARNING ) )
12
+ logging .getLogger ("botocore" ).setLevel (os . environ . get ( "LOG_LEVEL_BOTOCORE" , logging .WARNING ) )
13
+ logging .getLogger ("nose" ).setLevel (os . environ . get ( "LOG_LEVEL_NOSE" , logging .WARNING ) )
14
+ logging .getLogger ("urllib3" ).setLevel (os . environ . get ( "LOG_LEVEL_URLLIB3" , logging .WARNING ) )
15
15
16
16
17
17
class Config :
You can’t perform that action at this time.
0 commit comments