Commit 587628c9 authored by Bronger, Torsten's avatar Bronger, Torsten
Browse files

Add logging facility

parent 5589df6b
import logging
from pathlib import Path
from pymongo import MongoClient
from ruamel.yaml import YAML
def setup_logging(level):
logger = logging.getLogger("findrd")
logger.setLevel(level)
ch = logging.StreamHandler()
ch.setLevel(level)
formatter = logging.Formatter("%(asctime)s %(my_module)s %(message)s", "%Y-%m-%d %H:%M:%S")
ch.setFormatter(formatter)
logger.addHandler(ch)
return logger
logger = setup_logging(logging.WARNING)
yaml = YAML()
configuration = yaml.load(Path("/etc/findrd/findrd.yaml"))
mongodb_client = MongoClient(configuration["mongodb_url"])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment