restic-compose-backup/restic_compose_backup/log.py

14 lines
360 B
Python
Raw Normal View History

2019-11-15 15:47:40 +00:00
import logging
import os
2019-11-15 15:47:40 +00:00
import sys
2019-12-03 08:40:02 +00:00
logger = logging.getLogger('restic_compose_backup')
HOSTNAME = os.environ['HOSTNAME']
2019-11-15 15:47:40 +00:00
level = logging.INFO
logger.setLevel(level)
ch = logging.StreamHandler(stream=sys.stdout)
ch.setLevel(level)
ch.setFormatter(logging.Formatter(f'%(asctime)s - {HOSTNAME} - %(name)s - %(levelname)s - %(message)s'))
2019-11-15 15:47:40 +00:00
logger.addHandler(ch)