mirror of
https://forgemia.inra.fr/theophile.terraz/acoused.git
synced 2026-10-30 03:10:40 +01:00
main: Add 'logging' basic config.
This commit is contained in:
1 parent
3e5ef5d2bc
commit
1c3f6fb015
1 file changed
+11
@@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QMainWindow
|
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||||
@@ -26,6 +27,13 @@ import matplotlib.pyplot as plt
|
|||||||
PERCENT_SCREEN_SIZE = 0.85
|
PERCENT_SCREEN_SIZE = 0.85
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.DEBUG,
|
||||||
|
format=('[AcouSed][%(levelname)s] %(message)s')
|
||||||
|
)
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
class MainApplication(QMainWindow):
|
class MainApplication(QMainWindow):
|
||||||
|
|
||||||
@@ -90,6 +98,9 @@ class MainApplication(QMainWindow):
|
|||||||
# ---------------- Text File Error -----------------
|
# ---------------- Text File Error -----------------
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.error(str(e))
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
with open("Error_file.txt", "w", encoding="utf-8") as sortie:
|
with open("Error_file.txt", "w", encoding="utf-8") as sortie:
|
||||||
sortie.write(str(e))
|
sortie.write(str(e))
|
||||||
sortie.write(traceback.format_exc())
|
sortie.write(traceback.format_exc())
|
||||||
|
|||||||
Reference in new issue
Block a user