From 66177c14e201972d6feb6dbdf5c0456e044ca264 Mon Sep 17 00:00:00 2001 From: William So Date: Thu, 6 Jun 2024 19:12:28 +0800 Subject: [PATCH] Add option `Intercept logging` Fixes [GH#38](https://github.com/polyipseity/obsidian-terminal/issues/38). Signed-off-by: William So --- .changeset/eight-cameras-sniff.md | 5 +++++ assets/locales/af/translation.json | 1 + assets/locales/am/translation.json | 1 + assets/locales/ar/translation.json | 1 + assets/locales/be/translation.json | 1 + assets/locales/bg/translation.json | 1 + assets/locales/bn/translation.json | 1 + assets/locales/ca/translation.json | 1 + assets/locales/cs/translation.json | 1 + assets/locales/da/translation.json | 1 + assets/locales/de/translation.json | 1 + assets/locales/el/translation.json | 1 + assets/locales/en/asset.json | 1 + assets/locales/en/translation.json | 1 + assets/locales/eo/translation.json | 1 + assets/locales/es/translation.json | 1 + assets/locales/eu/translation.json | 1 + assets/locales/fa/translation.json | 1 + assets/locales/fi/translation.json | 1 + assets/locales/fr/translation.json | 1 + assets/locales/gl/translation.json | 1 + assets/locales/he/translation.json | 1 + assets/locales/hi/translation.json | 1 + assets/locales/hu/translation.json | 1 + assets/locales/id/translation.json | 1 + assets/locales/it/translation.json | 1 + assets/locales/ja/translation.json | 1 + assets/locales/ko/translation.json | 1 + assets/locales/lv/translation.json | 1 + assets/locales/ml/translation.json | 1 + assets/locales/ms/translation.json | 1 + assets/locales/nl/translation.json | 1 + assets/locales/no/translation.json | 1 + assets/locales/oc/translation.json | 1 + assets/locales/pl/translation.json | 1 + assets/locales/pt-BR/translation.json | 1 + assets/locales/pt/translation.json | 1 + assets/locales/ro/translation.json | 1 + assets/locales/ru/translation.json | 1 + assets/locales/se/translation.json | 1 + assets/locales/sk/translation.json | 1 + assets/locales/sq/translation.json | 1 + assets/locales/sr/translation.json | 1 + assets/locales/ta/translation.json | 1 + assets/locales/te/translation.json | 1 + assets/locales/th/translation.json | 1 + assets/locales/tr/translation.json | 1 + assets/locales/uk/translation.json | 1 + assets/locales/ur/translation.json | 1 + assets/locales/zh-Hans/translation.json | 1 + assets/locales/zh-Hant/translation.json | 1 + sources/main.ts | 8 ++++++++ sources/patch.ts | 21 ++++++++++++++++++++- sources/settings-data.ts | 8 ++++++++ sources/settings.ts | 20 ++++++++++++++++++++ 55 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 .changeset/eight-cameras-sniff.md diff --git a/.changeset/eight-cameras-sniff.md b/.changeset/eight-cameras-sniff.md new file mode 100644 index 00000000..0571b906 --- /dev/null +++ b/.changeset/eight-cameras-sniff.md @@ -0,0 +1,5 @@ +--- +"obsidian-terminal": minor +--- + +Add option `Intercept logging`. Fixes [GH#38](https://github.com/polyipseity/obsidian-terminal/issues/38). diff --git a/assets/locales/af/translation.json b/assets/locales/af/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/af/translation.json +++ b/assets/locales/af/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/am/translation.json b/assets/locales/am/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/am/translation.json +++ b/assets/locales/am/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ar/translation.json b/assets/locales/ar/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ar/translation.json +++ b/assets/locales/ar/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/be/translation.json b/assets/locales/be/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/be/translation.json +++ b/assets/locales/be/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/bg/translation.json b/assets/locales/bg/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/bg/translation.json +++ b/assets/locales/bg/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/bn/translation.json b/assets/locales/bn/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/bn/translation.json +++ b/assets/locales/bn/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ca/translation.json b/assets/locales/ca/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ca/translation.json +++ b/assets/locales/ca/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/cs/translation.json b/assets/locales/cs/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/cs/translation.json +++ b/assets/locales/cs/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/da/translation.json b/assets/locales/da/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/da/translation.json +++ b/assets/locales/da/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/de/translation.json b/assets/locales/de/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/de/translation.json +++ b/assets/locales/de/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/el/translation.json b/assets/locales/el/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/el/translation.json +++ b/assets/locales/el/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/en/asset.json b/assets/locales/en/asset.json index e0f27632..b30e16ca 100644 --- a/assets/locales/en/asset.json +++ b/assets/locales/en/asset.json @@ -110,6 +110,7 @@ "expose-internal-modules-icon": "puzzle", "focus-on-new-instance-icon": "focus", "hide-status-bar-icon": "eye-off", + "intercept-logging-icon": "scroll-text", "new-instance-behavior-icon": "plus", "open-changelog-on-update-icon": "$t(asset:generic.documentations.changelog-icon)", "pin-new-instance-icon": "pin", diff --git a/assets/locales/en/translation.json b/assets/locales/en/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/en/translation.json +++ b/assets/locales/en/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/eo/translation.json b/assets/locales/eo/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/eo/translation.json +++ b/assets/locales/eo/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/es/translation.json b/assets/locales/es/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/es/translation.json +++ b/assets/locales/es/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/eu/translation.json b/assets/locales/eu/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/eu/translation.json +++ b/assets/locales/eu/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/fa/translation.json b/assets/locales/fa/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/fa/translation.json +++ b/assets/locales/fa/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/fi/translation.json b/assets/locales/fi/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/fi/translation.json +++ b/assets/locales/fi/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/fr/translation.json b/assets/locales/fr/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/fr/translation.json +++ b/assets/locales/fr/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/gl/translation.json b/assets/locales/gl/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/gl/translation.json +++ b/assets/locales/gl/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/he/translation.json b/assets/locales/he/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/he/translation.json +++ b/assets/locales/he/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/hi/translation.json b/assets/locales/hi/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/hi/translation.json +++ b/assets/locales/hi/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/hu/translation.json b/assets/locales/hu/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/hu/translation.json +++ b/assets/locales/hu/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/id/translation.json b/assets/locales/id/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/id/translation.json +++ b/assets/locales/id/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/it/translation.json b/assets/locales/it/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/it/translation.json +++ b/assets/locales/it/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ja/translation.json b/assets/locales/ja/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ja/translation.json +++ b/assets/locales/ja/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ko/translation.json b/assets/locales/ko/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ko/translation.json +++ b/assets/locales/ko/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/lv/translation.json b/assets/locales/lv/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/lv/translation.json +++ b/assets/locales/lv/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ml/translation.json b/assets/locales/ml/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ml/translation.json +++ b/assets/locales/ml/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ms/translation.json b/assets/locales/ms/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ms/translation.json +++ b/assets/locales/ms/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/nl/translation.json b/assets/locales/nl/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/nl/translation.json +++ b/assets/locales/nl/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/no/translation.json b/assets/locales/no/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/no/translation.json +++ b/assets/locales/no/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/oc/translation.json b/assets/locales/oc/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/oc/translation.json +++ b/assets/locales/oc/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/pl/translation.json b/assets/locales/pl/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/pl/translation.json +++ b/assets/locales/pl/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/pt-BR/translation.json b/assets/locales/pt-BR/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/pt-BR/translation.json +++ b/assets/locales/pt-BR/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/pt/translation.json b/assets/locales/pt/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/pt/translation.json +++ b/assets/locales/pt/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ro/translation.json b/assets/locales/ro/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ro/translation.json +++ b/assets/locales/ro/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ru/translation.json b/assets/locales/ru/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ru/translation.json +++ b/assets/locales/ru/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/se/translation.json b/assets/locales/se/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/se/translation.json +++ b/assets/locales/se/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/sk/translation.json b/assets/locales/sk/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/sk/translation.json +++ b/assets/locales/sk/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/sq/translation.json b/assets/locales/sq/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/sq/translation.json +++ b/assets/locales/sq/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/sr/translation.json b/assets/locales/sr/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/sr/translation.json +++ b/assets/locales/sr/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ta/translation.json b/assets/locales/ta/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ta/translation.json +++ b/assets/locales/ta/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/te/translation.json b/assets/locales/te/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/te/translation.json +++ b/assets/locales/te/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/th/translation.json b/assets/locales/th/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/th/translation.json +++ b/assets/locales/th/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/tr/translation.json b/assets/locales/tr/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/tr/translation.json +++ b/assets/locales/tr/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/uk/translation.json b/assets/locales/uk/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/uk/translation.json +++ b/assets/locales/uk/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/ur/translation.json b/assets/locales/ur/translation.json index 917e7e7c..0c26aa5b 100644 --- a/assets/locales/ur/translation.json +++ b/assets/locales/ur/translation.json @@ -273,6 +273,7 @@ "running": "When $t(generic.terminal) is running" }, "instancing": "$t(generic.instance_gerund, capitalize)", + "intercept-logging": "Intercept logging", "interface": "Interface", "new-instance-behavior": "New $t(generic.instance) $t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/zh-Hans/translation.json b/assets/locales/zh-Hans/translation.json index f81e2734..06d02d81 100644 --- a/assets/locales/zh-Hans/translation.json +++ b/assets/locales/zh-Hans/translation.json @@ -259,6 +259,7 @@ "running": "当执行$t(generic.terminal)时" }, "instancing": "$t(generic.instance)", + "intercept-logging": "拦截记录", "interface": "界面", "new-instance-behavior": "新$t(generic.instance)$t(generic.behavior)", "new-instance-behaviors": { diff --git a/assets/locales/zh-Hant/translation.json b/assets/locales/zh-Hant/translation.json index f523d2b4..aacc2070 100644 --- a/assets/locales/zh-Hant/translation.json +++ b/assets/locales/zh-Hant/translation.json @@ -259,6 +259,7 @@ "running": "當執行$t(generic.terminal)時" }, "instancing": "$t(generic.instance)", + "intercept-logging": "攔截記錄", "interface": "界面", "new-instance-behavior": "新$t(generic.instance)$t(generic.behavior)", "new-instance-behaviors": { diff --git a/sources/main.ts b/sources/main.ts index 7112dbc5..555de7b4 100644 --- a/sources/main.ts +++ b/sources/main.ts @@ -101,6 +101,14 @@ export class TerminalPlugin await Promise.all(earlyChildren.map(async child => child.onLoaded)) for (const child of children) { this.addChild(child) } await Promise.all([ + Promise.resolve().then(() => { + settings.onMutate( + settings0 => settings0.interceptLogging, + cur => { this.earlyPatch.value.enableLoggingPatch(cur) }, + ) + this.earlyPatch.value + .enableLoggingPatch(settings.value.interceptLogging) + }), Promise.resolve().then(() => { loadPatch(this) }), Promise.resolve().then(() => { loadIcons(this) }), Promise.resolve().then(() => { diff --git a/sources/patch.ts b/sources/patch.ts index 4cf0ea4d..a4d85c04 100644 --- a/sources/patch.ts +++ b/sources/patch.ts @@ -149,6 +149,7 @@ function patchLogging( export interface EarlyPatch { readonly log: Log + readonly enableLoggingPatch: (enable: boolean) => void } function earlyPatch(app: App, options?: { readonly maxHistory?: number | undefined @@ -157,8 +158,26 @@ function earlyPatch(app: App, options?: { try { const { workspace } = app, log = new Log(options?.maxHistory) - unpatch.push(patchWindows(workspace, self0 => patchLogging(self0, log))) + let loggingPatch: (() => void) | null = null + + unpatch.push(() => { if (loggingPatch) { loggingPatch() } }) + loggingPatch = patchWindows(workspace, self0 => patchLogging(self0, log)) + return Object.freeze({ + enableLoggingPatch(enable: boolean) { + if (enable) { + if (loggingPatch) { return } + loggingPatch = + patchWindows(workspace, self0 => patchLogging(self0, this.log)) + return + } + if (!loggingPatch) { return } + try { + loggingPatch() + } finally { + loggingPatch = null + } + }, log, unpatch() { unpatch.call() }, }) diff --git a/sources/settings-data.ts b/sources/settings-data.ts index aecb1d17..76b6d38e 100644 --- a/sources/settings-data.ts +++ b/sources/settings-data.ts @@ -83,6 +83,7 @@ export interface Settings extends PluginContext.Settings { readonly hideStatusBar: Settings.HideStatusBarOption readonly exposeInternalModules: boolean + readonly interceptLogging: boolean readonly preferredRenderer: Settings.PreferredRendererOption } export namespace Settings { @@ -106,6 +107,7 @@ export namespace Settings { exposeInternalModules: true, focusOnNewInstance: true, hideStatusBar: "focused", + interceptLogging: true, language: "", newInstanceBehavior: "newHorizontalSplit", noticeTimeout: 5, @@ -1162,6 +1164,12 @@ export namespace Settings { "hideStatusBar", HIDE_STATUS_BAR_OPTIONS, ), + interceptLogging: fixTyped( + DEFAULT, + unc, + "interceptLogging", + ["boolean"], + ), language: fixInSet( DEFAULT, unc, diff --git a/sources/settings.ts b/sources/settings.ts index d89e3cbd..d8e33c67 100644 --- a/sources/settings.ts +++ b/sources/settings.ts @@ -324,6 +324,26 @@ export class SettingTab extends AdvancedSettingTab { () => { this.postMutate() }, )) }) + .newSetting(containerEl, setting => { + setting + .setName(i18n.t("settings.intercept-logging")) + .addToggle(linkSetting( + () => settings.value.interceptLogging, + async value => settings.mutate(settingsM => { + settingsM.interceptLogging = value + }), + () => { this.postMutate() }, + )) + .addExtraButton(resetButton( + i18n.t("asset:settings.intercept-logging-icon"), + i18n.t("settings.reset"), + async () => settings.mutate(settingsM => { + settingsM.interceptLogging = + Settings.DEFAULT.interceptLogging + }), + () => { this.postMutate() }, + )) + }) .newSetting(containerEl, setting => { setting .setName(i18n.t("settings.preferred-renderer"))