You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
420 B
Python
18 lines
420 B
Python
import logging.config
|
|
import os
|
|
|
|
import yaml
|
|
|
|
|
|
def setup_logging(path="./src/logging.yaml", default_level=logging.INFO):
|
|
"""
|
|
Setup logging configuration
|
|
"""
|
|
if os.path.exists(path):
|
|
with open(path, "rt") as f:
|
|
config = yaml.safe_load(f.read())
|
|
logging.config.dictConfig(config)
|
|
else:
|
|
logging.basicConfig(level=default_level)
|
|
return logging.getLogger(__name__)
|