From 0026008178137b4650e662f470f3c6d4a10aa167 Mon Sep 17 00:00:00 2001 From: sdttttt Date: Thu, 14 Sep 2023 16:49:39 +0800 Subject: [PATCH] =?UTF-8?q?[Feature]=20=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=AD=89=E7=BA=A7=E8=AE=BE=E7=BD=AE=20(#215)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add LogLevel option. * style: update debug log color. * fix: code lint, constant extract, i18 * chore: Add prettierignore * refactor: Remove LogType. * fix(type err.): type err * Update src/signals/request.ts Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> Signed-off-by: sdttttt * refactor: var name change. * Update package.json Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> Signed-off-by: sdttttt --------- Signed-off-by: sdttttt Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> --- .prettierignore | 2 ++ .prettierrc | 3 ++- package.json | 1 + src/constants/index.ts | 8 ++++++++ src/i18n/en.ts | 6 ++++++ src/i18n/zh.ts | 6 ++++++ src/pages/Config.tsx | 30 ++++++++++++++++++++++++++++++ src/pages/Logs.tsx | 16 ++++++++++------ src/signals/config.ts | 6 ++++++ src/signals/request.ts | 10 ++++++++-- src/types/index.d.ts | 5 ++++- 11 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..9a7cc76 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +CHANGELOG.md +pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc index 042b6cc..d4bad54 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,6 @@ "prettier-plugin-tailwindcss" ], "semi": false, - "singleQuote": true + "singleQuote": true, + "endOfLine": "crlf" } diff --git a/package.json b/package.json index 54afb87..471b3fc 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "vite build", "dev": "vite", + "format": "prettier -w .", "prepare": "husky install", "serve": "vite preview" }, diff --git a/src/constants/index.ts b/src/constants/index.ts index 0a3c058..07fd3a8 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -153,3 +153,11 @@ export enum MODE_OPTIONS { Rule = 'rule', Direct = 'direct', } + +export enum LOG_LEVEL { + Info = 'info', + Error = 'error', + Warning = 'warning', + Debug = 'debug', + Silent = 'silent', +} diff --git a/src/i18n/en.ts b/src/i18n/en.ts index e4b8033..dc6d71d 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -61,6 +61,12 @@ export default { updated: 'Updated', renderProxiesInSamePage: 'Render proxies and proxy provider in same page', tableSize: 'Table size', + logLevel: 'Log Level', + info: 'info', + silent: 'silent', + debug: 'debug', + warning: 'warning', + error: 'error', xs: 'Extra small size', sm: 'Small size', md: 'Normal size', diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index 012cc25..775b1c3 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -61,6 +61,12 @@ export default { updated: '更新于', renderProxiesInSamePage: '将代理和代理提供者显示在同一页', tableSize: '表格大小', + logLevel: '日志等级', + info: '信息', + silent: '静默', + debug: '调试', + warning: '警告', + error: '错误', xs: '超小尺寸', sm: '小尺寸', md: '正常尺寸', diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 22846e5..64abf6a 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -25,6 +25,7 @@ import { import { Button } from '~/components' import { LANG, + LOG_LEVEL, MODE_OPTIONS, PROXIES_ORDERING_TYPE, PROXIES_PREVIEW_TYPE, @@ -40,6 +41,7 @@ import { favDayTheme, favNightTheme, latencyTestTimeoutDuration, + logLevel, proxiesOrderingType, proxiesPreviewType, renderInTwoColumns, @@ -49,6 +51,7 @@ import { setFavDayTheme, setFavNightTheme, setLatencyTestTimeoutDuration, + setLogLevel, setProxiesOrderingType, setProxiesPreviewType, setRenderInTwoColumns, @@ -407,6 +410,33 @@ const ConfigForXd = () => { +
+ {t('logLevel')} + + +
+