mirror of
https://github.com/jetkvm/kvm.git
synced 2026-05-21 05:20:35 +00:00
fix(logging): reset troubleshooting log level after reboot (#1404)
* fix(logging): reset troubleshooting log level after reboot Restore WARN on boot so temporary troubleshooting verbosity cannot silently fill device storage before rolling logs land. Update the settings copy to describe the reboot reset, add an e2e regression test for the INFO-to-WARN behavior, and make the i18n resort helper accept lint-staged file arguments. * fix(i18n): avoid formatter churn in locale files Keep localization message JSON on the repo's existing resort_messages.py formatting so translation-only changes do not explode into full-file diffs. Remove JSON from the generic oxfmt lint-staged rule and restage the locale files in their canonical format.
This commit is contained in:
@@ -291,6 +291,9 @@ func LoadConfig() {
|
||||
loadedConfig.KeyboardLayout = "en-US"
|
||||
}
|
||||
|
||||
// Until rolling logs land, do not persist verbose levels across reboots.
|
||||
loadedConfig.DefaultLogLevel = "WARN"
|
||||
|
||||
// Migrate old default EDID (Toshiba TSB, no CEA extension) to new JetKVM v1 EDID
|
||||
const oldDefaultEDID = "00ffffffffffff0052620188008888881c150103800000780a0dc9a05747982712484c00000001010101010101010101010101010101023a801871382d40582c4500c48e2100001e011d007251d01e206e285500c48e2100001e000000fc00543734392d6648443732300a20000000fd00147801ff1d000a202020202020017b"
|
||||
if loadedConfig.EdidString == "" || loadedConfig.EdidString == oldDefaultEDID {
|
||||
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
waitForWebRTCReady,
|
||||
dismissSessionTakeoverDialog,
|
||||
callJsonRpc,
|
||||
reconnectAfterReboot,
|
||||
rebootDeviceViaSSH,
|
||||
sshExec,
|
||||
} from "./helpers";
|
||||
|
||||
@@ -82,4 +84,38 @@ test.describe("Log level filtering", () => {
|
||||
await callJsonRpc(page, "setDefaultLogLevel", { level: originalLevel }).catch(() => {});
|
||||
}
|
||||
});
|
||||
|
||||
test("reverts INFO to WARN after reboot", async ({ page }) => {
|
||||
test.setTimeout(90_000);
|
||||
|
||||
await page.goto("/");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await ensureLocalAuthMode(page, { mode: "noPassword" });
|
||||
await dismissSessionTakeoverDialog(page);
|
||||
await waitForWebRTCReady(page);
|
||||
|
||||
const originalLevel = (await callJsonRpc(page, "getDefaultLogLevel")) as LogLevel;
|
||||
|
||||
try {
|
||||
await callJsonRpc(page, "setDefaultLogLevel", { level: "INFO" });
|
||||
await expect
|
||||
.poll(() => callJsonRpc(page, "getDefaultLogLevel"), {
|
||||
message: "Waiting for default log level to be INFO after setDefaultLogLevel",
|
||||
intervals: [200, 500, 1000],
|
||||
})
|
||||
.toBe("INFO");
|
||||
|
||||
await rebootDeviceViaSSH();
|
||||
await reconnectAfterReboot(page, 3000, 20);
|
||||
|
||||
await expect
|
||||
.poll(() => callJsonRpc(page, "getDefaultLogLevel"), {
|
||||
message: "Waiting for default log level to revert to WARN after reboot",
|
||||
intervals: [200, 500, 1000],
|
||||
})
|
||||
.toBe("WARN");
|
||||
} finally {
|
||||
await callJsonRpc(page, "setDefaultLogLevel", { level: originalLevel }).catch(() => {});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
"advanced_success_loopback_enabled": "Modd loopback yn unig wedi'i alluogi. Ailgychwynnwch eich dyfais i'w gymhwyso.",
|
||||
"advanced_success_update_ssh_key": "Allwedd SSH wedi'i diweddaru'n llwyddiannus",
|
||||
"advanced_title": "Uwch",
|
||||
"advanced_troubleshooting_log_level_description": "Addaswch fanylion log ar gyfer diagnosteg. Gall lefelau uwch effeithio ar berfformiad",
|
||||
"advanced_troubleshooting_log_level_description": "Addaswch fanylder log ar gyfer diagnosteg. Bydd yn ailosod i Rhybudd ar ôl ailgychwyn",
|
||||
"advanced_troubleshooting_log_level_title": "Lefel log",
|
||||
"advanced_troubleshooting_mode_description": "Offer diagnostig a rheolaethau ychwanegol ar gyfer datrys problemau a dibenion datblygu",
|
||||
"advanced_troubleshooting_mode_title": "Modd Datrys Problemau",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Konfigurationen er nulstillet til standard",
|
||||
"advanced_success_update_ssh_key": "SSH-nøglen er blevet opdateret",
|
||||
"advanced_title": "Avanceret",
|
||||
"advanced_troubleshooting_log_level_description": "Juster logdetaljer til fejlsøgning. Højere niveauer kan påvirke ydeevnen",
|
||||
"advanced_troubleshooting_log_level_description": "Juster logdetaljer til fejlsøgning. Nulstilles til Advarsel ved genstart",
|
||||
"advanced_troubleshooting_log_level_title": "Logniveau",
|
||||
"advanced_troubleshooting_mode_description": "Diagnostiske værktøjer og yderligere kontroller til fejlfinding og udviklingsformål",
|
||||
"advanced_troubleshooting_mode_title": "Fejlfindingstilstand",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Konfiguration erfolgreich auf Standard zurückgesetzt",
|
||||
"advanced_success_update_ssh_key": "SSH-Schlüssel erfolgreich aktualisiert",
|
||||
"advanced_title": "Erweitert",
|
||||
"advanced_troubleshooting_log_level_description": "Protokolldetails für die Diagnose anpassen. Höhere Stufen können die Leistung beeinträchtigen",
|
||||
"advanced_troubleshooting_log_level_description": "Protokolldetail für Diagnosen anpassen. Wird beim Neustart auf Warnung zurückgesetzt",
|
||||
"advanced_troubleshooting_log_level_title": "Protokollebene",
|
||||
"advanced_troubleshooting_mode_description": "Diagnosetools und zusätzliche Steuerelemente für Fehlerbehebungs- und Entwicklungszwecke",
|
||||
"advanced_troubleshooting_mode_title": "Fehlerbehebungsmodus",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Configuration reset to default successfully",
|
||||
"advanced_success_update_ssh_key": "SSH key updated successfully",
|
||||
"advanced_title": "Advanced",
|
||||
"advanced_troubleshooting_log_level_description": "Adjust log detail for diagnostics. Higher levels may impact performance",
|
||||
"advanced_troubleshooting_log_level_description": "Adjust log detail for diagnostics. Reverts to Warning after reboot",
|
||||
"advanced_troubleshooting_log_level_title": "Log Level",
|
||||
"advanced_troubleshooting_mode_description": "Diagnostic tools and additional controls for troubleshooting and development purposes",
|
||||
"advanced_troubleshooting_mode_title": "Troubleshooting Mode",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "La configuración se restableció a los valores predeterminados correctamente",
|
||||
"advanced_success_update_ssh_key": "Clave SSH actualizada exitosamente",
|
||||
"advanced_title": "Avanzado",
|
||||
"advanced_troubleshooting_log_level_description": "Ajuste el detalle del registro para diagnósticos. Los niveles altos pueden afectar el rendimiento",
|
||||
"advanced_troubleshooting_log_level_description": "Ajuste el nivel de detalle del registro para diagnósticos. Vuelve a Advertencia al reiniciar",
|
||||
"advanced_troubleshooting_log_level_title": "Nivel de registro",
|
||||
"advanced_troubleshooting_mode_description": "Herramientas de diagnóstico y controles adicionales para resolución de problemas y fines de desarrollo",
|
||||
"advanced_troubleshooting_mode_title": "Modo de solución de problemas",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "La configuration par défaut a été réinitialisée avec succès",
|
||||
"advanced_success_update_ssh_key": "Clé SSH mise à jour avec succès",
|
||||
"advanced_title": "Avancé",
|
||||
"advanced_troubleshooting_log_level_description": "Ajustez le détail des journaux pour le diagnostic. Les niveaux élevés peuvent affecter les performances",
|
||||
"advanced_troubleshooting_log_level_description": "Ajustez le niveau de détail des journaux pour le diagnostic. Revient à Avertissement au redémarrage",
|
||||
"advanced_troubleshooting_log_level_title": "Niveau de journalisation",
|
||||
"advanced_troubleshooting_mode_description": "Outils de diagnostic et contrôles supplémentaires à des fins de dépannage et de développement",
|
||||
"advanced_troubleshooting_mode_title": "Mode de dépannage",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Configurazione ripristinata ai valori predefiniti con successo",
|
||||
"advanced_success_update_ssh_key": "Chiave SSH aggiornata correttamente",
|
||||
"advanced_title": "Avanzato",
|
||||
"advanced_troubleshooting_log_level_description": "Regola il dettaglio dei log per la diagnostica. Livelli più alti possono influire sulle prestazioni",
|
||||
"advanced_troubleshooting_log_level_description": "Regola il livello di dettaglio dei log per la diagnostica. Torna su Avviso al riavvio",
|
||||
"advanced_troubleshooting_log_level_title": "Livello di log",
|
||||
"advanced_troubleshooting_mode_description": "Strumenti diagnostici e controlli aggiuntivi per la risoluzione dei problemi e lo sviluppo",
|
||||
"advanced_troubleshooting_mode_title": "Modalità di risoluzione dei problemi",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "設定が正常にデフォルトにリセットされました",
|
||||
"advanced_success_update_ssh_key": "SSHキーが正常に更新されました",
|
||||
"advanced_title": "詳細設定",
|
||||
"advanced_troubleshooting_log_level_description": "診断用にログの詳細度を調整します。レベルが高いほどパフォーマンスに影響する場合があります",
|
||||
"advanced_troubleshooting_log_level_description": "診断用にログの詳細度を調整します。再起動すると「警告」に戻ります",
|
||||
"advanced_troubleshooting_log_level_title": "ログレベル",
|
||||
"advanced_troubleshooting_mode_description": "トラブルシューティングおよび開発目的の診断ツールと追加コントロール",
|
||||
"advanced_troubleshooting_mode_title": "トラブルシューティングモード",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Konfigurasjonen ble tilbakestilt til standard",
|
||||
"advanced_success_update_ssh_key": "SSH-nøkkelen er oppdatert",
|
||||
"advanced_title": "Avansert",
|
||||
"advanced_troubleshooting_log_level_description": "Juster loggdetaljer for feilsøking. Høyere nivåer kan påvirke ytelsen",
|
||||
"advanced_troubleshooting_log_level_description": "Juster loggdetaljer for feilsøking. Tilbakestilles til Advarsel ved omstart",
|
||||
"advanced_troubleshooting_log_level_title": "Loggnivå",
|
||||
"advanced_troubleshooting_mode_description": "Diagnostiske verktøy og tilleggskontroller for feilsøking og utviklingsformål",
|
||||
"advanced_troubleshooting_mode_title": "Feilsøkingsverktøy",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Configuração redefinida para o padrão com sucesso",
|
||||
"advanced_success_update_ssh_key": "Chave SSH atualizada com sucesso",
|
||||
"advanced_title": "Avançado",
|
||||
"advanced_troubleshooting_log_level_description": "Ajuste o detalhe dos registos para diagnóstico. Níveis mais elevados podem afetar o desempenho",
|
||||
"advanced_troubleshooting_log_level_description": "Ajuste o detalhe dos registos para diagnóstico. Repõe Aviso ao reiniciar",
|
||||
"advanced_troubleshooting_log_level_title": "Nível de registo",
|
||||
"advanced_troubleshooting_mode_description": "Ferramentas de diagnóstico e controles adicionais para solução de problemas e fins de desenvolvimento",
|
||||
"advanced_troubleshooting_mode_title": "Modo de Solução de Problemas",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Конфигурация успешно сброшена по умолчанию",
|
||||
"advanced_success_update_ssh_key": "SSH-ключ успешно обновлён",
|
||||
"advanced_title": "Дополнительно",
|
||||
"advanced_troubleshooting_log_level_description": "Настройте детализацию журналов для диагностики. Высокие уровни могут повлиять на производительность",
|
||||
"advanced_troubleshooting_log_level_description": "Настройте детализацию логов для диагностики. После перезагрузки сбрасывается на «Предупреждение»",
|
||||
"advanced_troubleshooting_log_level_title": "Уровень журналирования",
|
||||
"advanced_troubleshooting_mode_description": "Диагностические инструменты и дополнительные элементы управления для устранения неполадок и разработки",
|
||||
"advanced_troubleshooting_mode_title": "Режим устранения неполадок",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "Konfigurationen återställdes till standardinställningarna",
|
||||
"advanced_success_update_ssh_key": "SSH-nyckeln har uppdaterats",
|
||||
"advanced_title": "Avancerat",
|
||||
"advanced_troubleshooting_log_level_description": "Justera loggdetaljer för felsökning. Högre nivåer kan påverka prestandan",
|
||||
"advanced_troubleshooting_log_level_description": "Justera loggnivån för felsökning. Återställs till Varning vid omstart",
|
||||
"advanced_troubleshooting_log_level_title": "Loggnivå",
|
||||
"advanced_troubleshooting_mode_description": "Diagnostikverktyg och ytterligare kontroller för felsökning och utvecklingsändamål",
|
||||
"advanced_troubleshooting_mode_title": "Felsökningsläge",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "設定已成功重設為預設值",
|
||||
"advanced_success_update_ssh_key": "SSH 金鑰更新成功",
|
||||
"advanced_title": "進階",
|
||||
"advanced_troubleshooting_log_level_description": "調整日誌詳細程度以便診斷。較高級別可能影響效能",
|
||||
"advanced_troubleshooting_log_level_description": "調整日誌詳細程度以便診斷。重新啟動後會重設為「警告」",
|
||||
"advanced_troubleshooting_log_level_title": "日誌級別",
|
||||
"advanced_troubleshooting_mode_description": "用於故障排除和開發目的的診斷工具及額外控制項",
|
||||
"advanced_troubleshooting_mode_title": "故障排除模式",
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
"advanced_success_reset_config": "配置已成功恢复为默认设置。",
|
||||
"advanced_success_update_ssh_key": "SSH 密钥更新成功。",
|
||||
"advanced_title": "高级设置",
|
||||
"advanced_troubleshooting_log_level_description": "调整日志详细程度以便诊断。较高级别可能影响性能",
|
||||
"advanced_troubleshooting_log_level_description": "调整日志详细程度以便诊断。重启后重置为“警告”",
|
||||
"advanced_troubleshooting_log_level_title": "日志级别",
|
||||
"advanced_troubleshooting_mode_description": "用于故障排查和开发的诊断工具及额外控制选项。",
|
||||
"advanced_troubleshooting_mode_title": "故障排查模式",
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": "oxlint --fix --deny-warnings",
|
||||
"*.{ts,tsx,js,jsx,json,css,md}": "oxfmt",
|
||||
"*.{ts,tsx,js,jsx,css,md}": "oxfmt",
|
||||
"localization/messages/*.json": "npm run i18n:resort"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -7,20 +7,32 @@ def main():
|
||||
p = argparse.ArgumentParser(
|
||||
description="Sort translations keys in message *.json files"
|
||||
)
|
||||
p.add_argument(
|
||||
"files", nargs="*", help="specific message JSON files to sort"
|
||||
)
|
||||
p.add_argument(
|
||||
"--path", default="./localization/messages/", help="path to messages *.json"
|
||||
)
|
||||
args = p.parse_args()
|
||||
|
||||
messages_path = Path(args.path)
|
||||
if not messages_path.is_dir():
|
||||
print(f"message path is not a directory: {messages_path}")
|
||||
raise SystemExit(2)
|
||||
if args.files:
|
||||
files = [Path(file) for file in args.files]
|
||||
missing = [file for file in files if not file.is_file()]
|
||||
if missing:
|
||||
print("message file(s) not found:")
|
||||
for file in missing:
|
||||
print(f" - {file}")
|
||||
raise SystemExit(2)
|
||||
else:
|
||||
messages_path = Path(args.path)
|
||||
if not messages_path.is_dir():
|
||||
print(f"message path is not a directory: {messages_path}")
|
||||
raise SystemExit(2)
|
||||
|
||||
files = list(messages_path.glob("*.json"))
|
||||
if len(files) == 0:
|
||||
print(f"no message files (*.json) found in: {messages_path}")
|
||||
raise SystemExit(3)
|
||||
files = list(messages_path.glob("*.json"))
|
||||
if len(files) == 0:
|
||||
print(f"no message files (*.json) found in: {messages_path}")
|
||||
raise SystemExit(3)
|
||||
|
||||
for f in files:
|
||||
print(f"Processing {f.name} ...")
|
||||
@@ -43,7 +55,10 @@ def main():
|
||||
json.dumps(out, ensure_ascii=False, indent=4) + "\n", encoding="utf-8"
|
||||
)
|
||||
|
||||
print(f"Processed {len(files)} files in {messages_path}")
|
||||
if args.files:
|
||||
print(f"Processed {len(files)} files")
|
||||
else:
|
||||
print(f"Processed {len(files)} files in {messages_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user