Changeset e62187d in ammosreader


Ignore:
Timestamp:
05/18/23 11:02:16 (2 years ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
AmmosSource, guix
Children:
726729c
Parents:
f30c38c
Message:

more configuration of logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ammosreader/__init__.py

    rf30c38c re62187d  
    11import logging
     2import os
     3from pathlib import Path
     4
    25logger = logging.getLogger(__name__)
     6
     7logging_dir = Path(os.environ.get('AMMOS_LOG_DIR'))
     8
     9if not log_dir.exists():
     10    log_dir = Path('/var/log/')
     11log_path = log_dir / 'ammos.log'
     12
     13if not log_path.exists():
     14    print(log_path, "does not exist")
     15    print("Logging disabled")
     16    logging.config.fileConfig('ammos_logging.conf')
     17else:
     18    logging.basicConfig(filename=str(log_path))
Note: See TracChangeset for help on using the changeset viewer.