finish logging
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
"""App configuration for Wire-Py"""
|
||||
|
||||
import logging
|
||||
import gettext
|
||||
import locale
|
||||
from pathlib import Path
|
||||
@ -28,6 +28,17 @@ class AppConfig:
|
||||
consistently and perform system-level setup tasks.
|
||||
"""
|
||||
|
||||
# Logging
|
||||
LOG_DIR = Path.home() / ".local/share/wirepy"
|
||||
Path(LOG_DIR).mkdir(parents=True, exist_ok=True)
|
||||
LOG_FILE_PATH = LOG_DIR / "wirepy.log"
|
||||
|
||||
logging.basicConfig(
|
||||
filename=f"{LOG_FILE_PATH}",
|
||||
level=logging.ERROR,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
||||
)
|
||||
|
||||
# Localization
|
||||
APP_NAME: str = "wirepy"
|
||||
LOCALE_DIR: Path = Path("/usr/share/locale/")
|
||||
@ -145,11 +156,9 @@ class AppConfig:
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
print(process.stdout)
|
||||
if process.returncode == 0:
|
||||
print(process.stdout)
|
||||
else:
|
||||
print(f"Error with the following code... {process.returncode}")
|
||||
|
||||
if process.stderr:
|
||||
logging.error(f"{process.stderr} Code: {process.returncode}", exc_info=True)
|
||||
|
||||
|
||||
# here is inizialize the class for translate strrings
|
||||
|
Reference in New Issue
Block a user