import logging
from pathlib import Path

_LOG_DIR = Path(__file__).resolve().parents[2] / 'logs'
_LOG_DIR.mkdir(parents=True, exist_ok=True)

logger = logging.getLogger('service_auto')
logger.propagate = False
if not logger.handlers:
    fh = logging.FileHandler(_LOG_DIR / 'service_auto.log')
    fh.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(name)s: %(message)s'))
    logger.addHandler(fh)
logger.setLevel(logging.INFO)
