File: debug_guide.md

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (23 lines) | stat: -rw-r--r-- 692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Debug

This guide is to help Python SDK users to get the process about how SDK call REST api

(1) Copy the following code in your .py file
```
import sys
import logging

logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(stream=sys.stdout, )
logger.addHandler(handler)
formatter = logging.Formatter(
    '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
```

![Position example](./debug_guide_position.png "Position example")

(2) Run your .py program and you could find the log info in screen. It is convenient to get the process about how SDK call REST api:

![example](./debug_guide_example.png "example")