Files
deskmeter/dmapp/dmcore/config.py
2025-05-13 05:01:16 -03:00

28 lines
634 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# dmapp/dmcore/config.py
import logging
from pymongo import MongoClient
# Logging configuration
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
# 2) Get your modules logger and bump it to DEBUG
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# 3) Silence pymongo (and any other libs you find chatty)
logging.getLogger("pymongo").setLevel(logging.WARNING)
# MongoDB configuration
client = MongoClient()
db = client.deskmeter
# Collections
switches = db.switch
states = db.state
tasks = db.task