feat: support dynamically set log level

This commit is contained in:
Gabe
2025-10-12 23:17:50 +08:00
parent f19b6ef02f
commit bfce9b525a
8 changed files with 119 additions and 18 deletions

View File

@@ -29,7 +29,7 @@ import { useShortcut } from "../../hooks/Shortcut";
import ShortcutInput from "./ShortcutInput";
import { useFab } from "../../hooks/Fab";
import { sendBgMsg } from "../../libs/msg";
import { kissLog } from "../../libs/log";
import { kissLog, LogLevel } from "../../libs/log";
import UploadButton from "./UploadButton";
import DownloadButton from "./DownloadButton";
import { getSettingOld } from "../../libs/storage";
@@ -99,6 +99,7 @@ export default function Settings() {
orilist = DEFAULT_ORILIST.join(",\n"),
transInterval = 100,
langDetector = "-",
logLevel = 1,
preInit = true,
skipLangs = [],
// detectRemote = true,
@@ -337,6 +338,23 @@ export default function Settings() {
))}
</TextField>
</Grid>
<Grid item xs={12} sm={12} md={6} lg={3}>
<TextField
select
fullWidth
size="small"
name="logLevel"
value={logLevel}
label={i18n("log_level")}
onChange={handleChange}
>
{Object.values(LogLevel).map(({ value, name }) => (
<MenuItem value={value} key={value}>
{name}
</MenuItem>
))}
</TextField>
</Grid>
</Grid>
</Box>