feat: WebUI 支持修改日志等级

This commit is contained in:
foxhui
2026-01-25 03:59:16 +08:00
Unverified
parent 02847223dc
commit 9815818def
6 changed files with 33 additions and 3 deletions
+4
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.5.1] - 2026-01-24
### ✨ Added
- **WebUI**
- 增加日志等级的设置
### 🐛 Fixed
- **代理**
- 修复无需鉴权的 Socks5 代理无法使用的问题
+3 -1
View File
@@ -46,7 +46,8 @@ export function getServerConfig() {
return {
port: config.server?.port || 3000,
authToken: config.server?.auth || '',
keepaliveMode: config.server?.keepalive?.mode || 'comment'
keepaliveMode: config.server?.keepalive?.mode || 'comment',
logLevel: config.logLevel || 'info'
};
}
@@ -65,6 +66,7 @@ export function saveServerConfig(data) {
if (!config.server.keepalive) config.server.keepalive = {};
config.server.keepalive.mode = data.keepaliveMode;
}
if (data.logLevel !== undefined) config.logLevel = data.logLevel;
writeConfig(config);
}
+7
View File
@@ -38,6 +38,13 @@ export function validateServerConfig(data) {
}
}
// Log Level 校验
if (data.logLevel !== undefined) {
if (!['debug', 'info', 'warn', 'error'].includes(data.logLevel)) {
errors.push('logLevel 必须是 debug、info、warn 或 error');
}
}
// Queue Buffer 校验
if (data.queueBuffer !== undefined) {
if (typeof data.queueBuffer !== 'number' || !Number.isInteger(data.queueBuffer)) {
+1 -1
View File
@@ -1 +1 @@
.ant-input-number[data-v-5b571484]{width:100%}
.ant-input-number[data-v-e88c66ad]{width:100%}
+1 -1
View File
File diff suppressed because one or more lines are too long
+17
View File
@@ -10,6 +10,7 @@ const formData = reactive({
port: 5173,
authToken: '',
keepaliveMode: 'comment',
logLevel: 'info',
queueBuffer: 2,
imageLimit: 5
});
@@ -91,6 +92,22 @@ const handleSave = async () => {
</a-select>
</div>
</a-col>
<!-- 日志等级 -->
<a-col :xs="24" :md="12">
<div style="margin-bottom: 8px;">
<div style="font-weight: 600; margin-bottom: 4px;">日志等级</div>
<div style="font-size: 12px; color: #8c8c8c; margin-bottom: 8px;">
设置服务器日志输出的详细程度
</div>
<a-select v-model:value="formData.logLevel" style="width: 100%" placeholder="请选择日志等级">
<a-select-option value="debug">Debug - 调试日志</a-select-option>
<a-select-option value="info">Info - 普通信息</a-select-option>
<a-select-option value="warn">Warn - 警告信息</a-select-option>
<a-select-option value="error">Error - 仅错误</a-select-option>
</a-select>
</div>
</a-col>
</a-row>
<!-- 保存按钮右下角 -->