15 lines
386 B
Python
15 lines
386 B
Python
#logging6.py
|
|
import logging
|
|
import logging.config
|
|
import yaml
|
|
|
|
with open('logging6.conf.yaml', 'r') as f:
|
|
config = yaml.safe_load(f.read())
|
|
logging.config.dictConfig(config)
|
|
|
|
logger = logging.getLogger('my_logger')
|
|
|
|
logger.error("This is an error message")
|
|
logger.warning("This is a warning message")
|
|
logger.info("This is a info message")
|
|
logger.debug("This is a debug message") |