Skip to content

Commit 1fca98a

Browse files
authored
Merge pull request #113 from Sapbasu15/master
Added 'How to enable logging' section in readme
2 parents f373b33 + aed5797 commit 1fca98a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ Authorize.Net maintains a complete sandbox environment for testing and developme
5151

5252
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
5353

54+
### Enable Logging in the SDK
55+
Python SDK uses the logger _'authorizenet.sdk'_. By default, the logger in the SDK is not configured to write output. You can configure the logger in your code to start seeing logs from the SDK.
56+
57+
A sample logger configuration is given as below:
58+
59+
```python
60+
import logging
61+
logger = logging.getLogger('authorizenet.sdk')
62+
handler = logging.FileHandler('anetSdk.log')
63+
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
64+
handler.setFormatter(formatter)
65+
logger.addHandler(handler)
66+
logger.setLevel(logging.DEBUG)
67+
logger.debug('Logger set up for Authorizenet Python SDK complete')
68+
```
69+
5470

5571
## SDK Usage Examples and Sample Code
5672
To get started using this SDK, it's highly recommended to download our sample code repository:

0 commit comments

Comments
 (0)