Skip to content

Commit 4f955aa

Browse files
Modified readme file with details for logging implementation
1 parent 22e2b2e commit 4f955aa

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,27 @@ SANDBOX_LICENSEKEY='your_sandbox_license_key'
170170
```
171171
Note: Only *Sandbox credentials* should be used for testing, as the test case will commit/adjust/void dummy transactions on the account to verify functionalities.
172172

173+
### Logging
174+
175+
Logging is implemented using standard Python logging framework.
176+
177+
1. All relevant methods from `AvataxClient` class are decorated with `ava_log` decorator.(This is achieved using another decorator at class level, `decorate_all_methods`)
178+
2. `ava_log` decorator collects relevant request data, response data useful for instrumentation and logs error data in case of exception.
179+
3. `AvataxClient` constructor is modified with optional parameter, `is_log_req_resp_allowed` (defaulted to False), to control if log entry should contain request and response objects.
180+
4. SDK Consumer code can also set logger property of `AvataxClient` to use already configured logger instance. e.g.
181+
```
182+
from logging import config
183+
184+
# configure logging using file config or dictConfig
185+
# or by setting basicConfig (this is default in case no logger is set)
186+
config.fileConfig("logger_config.conf")
187+
188+
logger = logging.getLogger()
189+
190+
# set logger property
191+
client.logger = logger
192+
```
193+
173194

174195
## Issue or suggestion
175196

0 commit comments

Comments
 (0)