add logger
This commit is contained in:
@@ -5,9 +5,18 @@ from pathlib import Path
|
|||||||
from src.backend.database import Database
|
from src.backend.database import Database
|
||||||
|
|
||||||
db = Database()
|
db = Database()
|
||||||
|
import loguru
|
||||||
|
import sys
|
||||||
|
|
||||||
|
log = loguru.logger
|
||||||
|
log.remove()
|
||||||
|
log.add("application.log", rotation="1 week", retention="1 month")
|
||||||
|
log.add(
|
||||||
|
sys.stdout,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def recreateFile(name, app_id, filetype, open=True) -> Path:
|
def recreateFile(name: str, app_id: int, filetype: str, open: bool = True) -> Path:
|
||||||
"""
|
"""
|
||||||
recreateFile creates a file from the database and opens it in the respective program, if the open parameter is set to True.
|
recreateFile creates a file from the database and opens it in the respective program, if the open parameter is set to True.
|
||||||
|
|
||||||
@@ -24,6 +33,7 @@ def recreateFile(name, app_id, filetype, open=True) -> Path:
|
|||||||
"""
|
"""
|
||||||
path = db.recreateFile(name, app_id, filetype=filetype)
|
path = db.recreateFile(name, app_id, filetype=filetype)
|
||||||
path = Path(path)
|
path = Path(path)
|
||||||
|
log.info(f"File created: {path}")
|
||||||
if open:
|
if open:
|
||||||
if os.getenv("OS") == "Windows_NT":
|
if os.getenv("OS") == "Windows_NT":
|
||||||
path = path.resolve()
|
path = path.resolve()
|
||||||
|
|||||||
Reference in New Issue
Block a user