Changeset d34008d in ammosreader
- Timestamp:
- 05/18/23 12:32:55 (2 years ago)
- Branches:
- AmmosSource, guix
- Children:
- 3c331d1
- Parents:
- 726729c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ammosreader/__init__.py
r726729c rd34008d 1 1 import logging 2 import logging.config 2 3 import os 3 4 from pathlib import Path … … 5 6 logger = logging.getLogger(__name__) 6 7 7 logging_dir = Path(os.environ.get('AMMOS_LOG_DIR', '/var/log/')) 8 # change the default log path to /var/log/ammos/ammos.log when system configuration created this dir 9 # with the appropriate rights 10 11 log_dir = Path(os.environ.get('AMMOS_LOG_DIR', '/tmp/')) 8 12 9 13 log_path = log_dir / 'ammos.log' 10 14 11 15 if not log_path.exists(): 12 print(log_path, "does not exist") 13 print("Logging disabled") 14 logging.config.fileConfig('ammos_logging.conf') 16 # print(log_path, "does not exist") 17 try: 18 # print("Trying to create logfile", str(log_path)) 19 log_path.touch() 20 except PermissionError: 21 # print("Logging to file disabled") 22 logging.config.fileConfig('ammos_logging.conf') 15 23 else: 24 # print("Logging to", str(log_path)) 16 25 logging.basicConfig(filename=str(log_path))
Note:
See TracChangeset
for help on using the changeset viewer.