source: flexoentity/flexoentity/logger.py

unify_backends
Last change on this file was 4dc09bb, checked in by Enrico Schwass <ennoausberlin@…>, 5 months ago

fix tempdir for windows - fix typo

  • Property mode set to 100644
File size: 643 bytes
Line 
1import logging
2import logging.config
3import os
4import tempfile
5from pathlib import Path
6
7
8log_dir = Path(os.environ.get('FLEXO_LOG_DIR', tempfile.gettempdir()))
9
10log_path = log_dir / 'flexo.log'
11
12if not log_path.exists():
13 try:
14 log_path.touch()
15 except PermissionError:
16 conf_file = Path(__file__).parent / 'flexo_logging.conf'
17 print("Conf file", conf_file)
18 logging.config.fileConfig(conf_file)
19else:
20 logging.basicConfig(filename=str(log_path), encoding='utf-8', level=logging.DEBUG)
21
22logger = logging.getLogger(__name__)
23
24logger.setLevel(os.environ.get('FLEXO_LOG_LEVEL', logger.getEffectiveLevel()))
Note: See TracBrowser for help on using the repository browser.