Skip to content

Commit 41c9a2e

Browse files
committed
python: Add example code for logger
Signed-off-by: Gris Ge <fge@redhat.com>
1 parent fbb351d commit 41c9a2e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

devel/py_example.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!-- vim-markdown-toc GFM -->
22

33
* [Python code examples](#python-code-examples)
4+
* [Change libnmstate logging](#change-libnmstate-logging)
45
* [Interface common tasks](#interface-common-tasks)
56
* [Remove interface configuration](#remove-interface-configuration)
67
* [Set static IP address](#set-static-ip-address)
@@ -36,6 +37,25 @@
3637

3738
# Python code examples
3839

40+
## Change libnmstate logging
41+
42+
New feature since 2.2.40
43+
44+
Nmstate python module introduced logger `libnmstate` which allow you to do
45+
specific tune on logging of nmstate only.
46+
47+
```python
48+
import logging
49+
import libnmstate
50+
51+
logging.basicConfig(level=logging.DEBUG)
52+
53+
logger = logging.getLogger("libnmstate")
54+
logger.setLevel(logging.DEBUG)
55+
56+
print(libnmstate.show())
57+
```
58+
3959
## Interface common tasks
4060
### Remove interface configuration
4161

0 commit comments

Comments
 (0)