Skip to content

Feat: Optional logging #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Afrikaans/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "General Settings",
"general.checkForUpdates": "Check For Updates",
"general.toolTip": "Toggle update check on launch",
"general.logging": "Enable Logging",
"general.loggingTooltip": "Save log file for debugging. (Restart needed)",
"general.oscSettings": "OSC Settings",
"general.locationPrefix": "Location Prefix",
"general.locationTooltip": "Prefix for OSC address",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Dansk/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Generelle Indstillinger",
"general.checkForUpdates": "Tjek For Opdateringer",
"general.toolTip": "Slå opdateringstjek ved start til eller fra",
"general.logging": "Aktiver logning",
"general.loggingTooltip": "Gem logfil til fejlfinding. (Genstart nødvendig)",
"general.oscSettings": "OSC Indstillinger",
"general.locationPrefix": "Stedpræfiks",
"general.locationTooltip": "Præfiks for OSC adresse",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Deutsch/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Allgemeine Einstellungen",
"general.checkForUpdates": "Nach Updates suchen",
"general.toolTip": "Beim Start nach Updates suchen",
"general.logging": "Protokollierung aktivieren",
"general.loggingTooltip": "Protokolldatei zum debuggen speichern. (Neustart erforderlich)",
"general.oscSettings": "OSC Einstellungen",
"general.locationPrefix": "Sprache Präfix",
"general.locationTooltip": "OSC Adressen-Präfix",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/English/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "General Settings",
"general.checkForUpdates": "Check For Updates",
"general.toolTip": "Toggle update check on launch",
"general.logging": "Enable Logging",
"general.loggingTooltip": "Save log file for debugging. (Restart needed)",
"general.oscSettings": "OSC Settings",
"general.locationPrefix": "Location Prefix",
"general.locationTooltip": "Prefix for OSC address",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Español/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Ajustes Generales",
"general.checkForUpdates": "Buscar actualizaciones",
"general.toolTip": "Elige buscar actualizaciones al arrancar",
"general.logging": "Habilitar registro",
"general.loggingTooltip": "Guardar archivo de registro para depuración. (Reinicio necesario)",
"general.oscSettings": "Ajustes de OSC",
"general.locationPrefix": "Prefijo de dirección",
"general.locationTooltip": "Prefijo para la dirección OSC",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Française/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Paramètres généraux",
"general.checkForUpdates": "Vérifier les mises à jour",
"general.toolTip": "Activer la vérification des mises à jour au démarrage",
"general.logging": "Activer l'enregistrement",
"general.loggingTooltip": "Enregistrer le fichier journal pour le débogage. (Redémarrage nécessaire)",
"general.oscSettings": "Paramètres OSC",
"general.locationPrefix": "Préfixe de localisation",
"general.locationTooltip": "Préfixe de l'adresse OSC",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Indonesian/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Pengaturan Umum",
"general.checkForUpdates": "Periksa Pembaruan",
"general.toolTip": "Aktifkan Memeriksa perbaruan saat buka aplikasi",
"general.logging": "Aktifkan Pencatatan",
"general.loggingTooltip": "Simpan berkas log untuk debugging. (Memulai ulang diperlukan)",
"general.oscSettings": "Pengaturan OSC",
"general.locationPrefix": "Awalan Lokasi",
"general.locationTooltip": "Awalan untuk OSC address",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Italiano/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Impostazioni Generali",
"general.checkForUpdates": "Verifica Disponibilità Aggiornamenti",
"general.toolTip": "Attiva/Disattiva Controllo Aggiornamenti all'Avvio",
"general.logging": "Attiva logging",
"general.loggingTooltip": "Salva il file di log per il debug. (Riavvio necessario)",
"general.oscSettings": "Impostazioni OSC",
"general.locationPrefix": "Prefisso Posizione",
"general.locationTooltip": "Prefisso per l'indirizzo OSC",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Nederlands/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Algemene Instellingen",
"general.checkForUpdates": "Checken Voor Updates",
"general.toolTip": "Update check bij opstarten inschakelen",
"general.logging": "Logging inschakelen",
"general.loggingTooltip": "Logbestand opslaan voor debugging. (Herstart nodig)",
"general.oscSettings": "OSC Instellingen",
"general.locationPrefix": "Voorvoegsel voor locatie",
"general.locationTooltip": "Voorvoegsel voor OSC-adres",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/OwO/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "genewaw settings OwO",
"general.checkForUpdates": "check fow updates UwU",
"general.toolTip": "toggwe update check on waunch >w<",
"general.logging": "Enabwe Wogging",
"general.loggingTooltip": "Save wog fiwe fow debugging. (Westawt needed)",
"general.oscSettings": "OSC sewtings nya~",
"general.locationPrefix": "wocation pwefix",
"general.locationTooltip": "pwefix fow OSC addwess OwO",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Pirate Speak/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Cap'n's Quarters",
"general.checkForUpdates": "Scour fer Booty Updates",
"general.toolTip": "Toggle update check when ye set sail",
"general.logging": "Commence Loggin'",
"general.loggingTooltip": "Stow log file fer fixin! (Needin' restart)",
"general.oscSettings": "OSC Riggin's",
"general.locationPrefix": "Treasure Map Prefix",
"general.locationTooltip": "Prefix fer yer OSC coordinates",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Polski/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Ustawienia główne",
"general.checkForUpdates": "Sprawdź aktualizacje",
"general.toolTip": "Automatyczne sprawdzanie aktualizacji przy włączeniu",
"general.logging": "Włącz logowanie",
"general.loggingTooltip": "Zapisz plik dziennika do debugowania. (Wymagany restart)",
"general.oscSettings": "Ustawienia OSC",
"general.locationPrefix": "Location Prefix",
"general.locationTooltip": "Prefix for OSC address",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Pусский/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Общие настройки",
"general.checkForUpdates": "Проверить обновления",
"general.toolTip": "Включить проверку обновлений при запуске",
"general.logging": "Включить ведение журнала",
"general.loggingTooltip": "Сохранить файл журнала для отладки. (Необходим перезапуск)",
"general.oscSettings": "Настройки OSC",
"general.locationPrefix": "Префикс местоположения",
"general.locationTooltip": "Префикс для адреса OSC",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/Svenska/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "Allmänna Inställningar",
"general.checkForUpdates": "Sök Efter Uppdateringar",
"general.toolTip": "Sök efter uppdateringar vid uppstart",
"general.logging": "Aktivera loggning",
"general.loggingTooltip": "Spara loggfil för felsökning. (Omstart behövs)",
"general.oscSettings": "OSC Inställningar",
"general.locationPrefix": "Plats Prefix",
"general.locationTooltip": "Prefix för OSC adress",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/简体中文/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "常规设置",
"general.checkForUpdates": "检查更新",
"general.toolTip": "启动时检查更新",
"general.logging": "启用日志记录",
"general.loggingTooltip": "保存日志文件以进行调试。(需要重启)",
"general.oscSettings": "OSC设置",
"general.locationPrefix": "位置前缀",
"general.locationTooltip": "OSC地址前缀",
Expand Down
2 changes: 2 additions & 0 deletions BabbleApp/Locale/繁體中文/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"general.header": "一般設定",
"general.checkForUpdates": "檢查更新",
"general.toolTip": "開啟時檢查更新",
"general.logging": "啟用日誌記錄",
"general.loggingTooltip": "保存日誌文件以進行除錯。(需要重啟)",
"general.oscSettings": "OSC 設定",
"general.locationPrefix": "位置前綴",
"general.locationTooltip": "OSC 位址的前綴",
Expand Down
5 changes: 4 additions & 1 deletion BabbleApp/babbleapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ def shutdown_all(self, timeout=5.0):

async def async_main():
ensurePath()
setup_logging()

# Get Configuration
config: BabbleConfig = BabbleConfig.load()

# Init logging. TODO: Initiate before "BabbleConfig.load()"?
if config.settings.gui_logging:
setup_logging()

# Init locale manager
lang("Locale", config.settings.gui_language)
Expand Down
1 change: 1 addition & 0 deletions BabbleApp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class BabbleSettingsConfig(BaseModel):
gui_osc_delay_enable: bool = False
gui_osc_delay_seconds: float = 0.01
gui_update_check: bool = True
gui_logging: bool = True #Prefer "False" for stable release?
gui_ROSC: bool = False
gui_osc_location: str = ""
gui_multiply: float = 1
Expand Down
13 changes: 13 additions & 0 deletions BabbleApp/general_settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(
self.gui_min_cutoff = f"-MINCUTOFF{widget_id}-"
self.gui_ROSC = f"-ROSC{widget_id}-"
self.gui_update_check = f"-UPDATECHECK{widget_id}-"
self.gui_logging = f"-LOGGING{widget_id}-"
self.gui_osc_location = f"-OSCLOCATION{widget_id}-"
self.gui_cam_resolution_x = f"-CAMRESX{widget_id}-"
self.gui_cam_resolution_y = f"-CAMRESY{widget_id}-"
Expand All @@ -45,6 +46,13 @@ def __init__(
background_color=bg_color_highlight,
tooltip=lang._instance.get_string("general.toolTip"),
),
sg.Checkbox(
lang._instance.get_string("general.logging"),
default=self.config.gui_logging,
key=self.gui_logging,
background_color=bg_color_highlight,
tooltip=lang._instance.get_string("general.loggingTooltip"),
),
],
[
sg.Text(
Expand Down Expand Up @@ -332,6 +340,11 @@ def render(self, window, event, values):
if self.config.gui_update_check != values[self.gui_update_check]:
self.config.gui_update_check = values[self.gui_update_check]
changed = True

# Logging option
if self.config.gui_logging != values[self.gui_logging]:
self.config.gui_logging = values[self.gui_logging]
changed = True

# Update disable camera preview option
value = values[self.gui_disable_camera_preview]
Expand Down