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 | |
|---|
| 1 | import logging
|
|---|
| 2 | import logging.config
|
|---|
| 3 | import os
|
|---|
| 4 | import tempfile
|
|---|
| 5 | from pathlib import Path
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 | log_dir = Path(os.environ.get('FLEXO_LOG_DIR', tempfile.gettempdir()))
|
|---|
| 9 |
|
|---|
| 10 | log_path = log_dir / 'flexo.log'
|
|---|
| 11 |
|
|---|
| 12 | if 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)
|
|---|
| 19 | else:
|
|---|
| 20 | logging.basicConfig(filename=str(log_path), encoding='utf-8', level=logging.DEBUG)
|
|---|
| 21 |
|
|---|
| 22 | logger = logging.getLogger(__name__)
|
|---|
| 23 |
|
|---|
| 24 | logger.setLevel(os.environ.get('FLEXO_LOG_LEVEL', logger.getEffectiveLevel()))
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.