diff --git a/restic_volume_backup/log.py b/restic_volume_backup/log.py index 2992507..20a0684 100644 --- a/restic_volume_backup/log.py +++ b/restic_volume_backup/log.py @@ -1,12 +1,13 @@ import logging +import os import sys logger = logging.getLogger('restic_volume_backup') +HOSTNAME = os.environ['HOSTNAME'] level = logging.INFO logger.setLevel(level) ch = logging.StreamHandler(stream=sys.stdout) ch.setLevel(level) -ch.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')) -# ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')) +ch.setFormatter(logging.Formatter(f'%(asctime)s - {HOSTNAME} - %(name)s - %(levelname)s - %(message)s')) logger.addHandler(ch)