-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathshared.py
More file actions
29 lines (24 loc) · 729 Bytes
/
shared.py
File metadata and controls
29 lines (24 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
XMLEdit GUI-onafhankelijke code
"""
import os
import pathlib
import logging
# from axe.gui import Gui
ELSTART = '<>'
iconame = str(pathlib.Path(__file__).parent / "ui/icon.ico")
# always log in program directory
LOGFILE = pathlib.Path('/tmp/logs/axe_qt.log')
LOGPLEASE = 'DEBUG' in os.environ and os.environ["DEBUG"] != "0"
if LOGPLEASE:
if not LOGFILE.parent.exists():
LOGFILE.parent.mkdir()
if not LOGFILE.exists():
LOGFILE.touch()
logging.basicConfig(filename=str(LOGFILE), level=logging.DEBUG,
format='%(asctime)s %(message)s')
def log(message):
"""if enabled, write a line to the log"""
if LOGPLEASE:
logging.info(message)