mirror of
https://github.com/apachecn/ailearning.git
synced 2026-05-01 05:51:01 +08:00
2020-10-19 21:08:55
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
In [1]:
|
||||
|
||||
```
|
||||
```py
|
||||
import logging
|
||||
|
||||
```
|
||||
@@ -23,7 +23,7 @@ import logging
|
||||
|
||||
In [2]:
|
||||
|
||||
```
|
||||
```py
|
||||
logging.critical('This is critical message')
|
||||
logging.error('This is error message')
|
||||
logging.warning('This is warning message')
|
||||
@@ -34,7 +34,7 @@ logging.debug('This is debug message')
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
CRITICAL:root:This is critical message
|
||||
ERROR:root:This is error message
|
||||
WARNING:root:This is warning message
|
||||
@@ -45,14 +45,14 @@ WARNING:root:This is warning message
|
||||
|
||||
In [3]:
|
||||
|
||||
```
|
||||
```py
|
||||
logging.root.setLevel(level=logging.INFO)
|
||||
|
||||
logging.info('This is info message')
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
INFO:root:This is info message
|
||||
|
||||
```
|
||||
@@ -61,7 +61,7 @@ INFO:root:This is info message
|
||||
|
||||
In [4]:
|
||||
|
||||
```
|
||||
```py
|
||||
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s')
|
||||
|
||||
logger = logging.getLogger("this program")
|
||||
@@ -70,7 +70,7 @@ logger.critical('This is critical message')
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
CRITICAL:this program:This is critical message
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user