Skip to content

Commit 15d8ab4

Browse files
committed
fix: improve log display when debug_enable is enabled
1 parent f429efc commit 15d8ab4

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

webui/src/pages/index/log.vue

+29-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ definePage({
66
const { onUpdate, offUpdate, reset, copy, getLog } = useLogStore();
77
const { log } = storeToRefs(useLogStore());
88
const { version } = useAppInfo();
9+
const { getConfig, getSettingGroup } = useConfigStore();
10+
const logSetting = getSettingGroup('log');
911
1012
const formatLog = computed(() => {
1113
const list = log.value
@@ -18,14 +20,15 @@ const formatLog = computed(() => {
1820
const parts = i.split('|');
1921
const [date, type, module_content] = [
2022
...parts.slice(0, 2),
21-
parts.slice(2).join('-'),
23+
parts.slice(2).join('|'),
2224
];
23-
const content = module_content.split('-').slice(1).join('-');
24-
console.log(content);
25+
const [module, ...contents] = module_content.split('-');
26+
const content = contents.join('-');
2527
return {
2628
index,
2729
date: date.trim(),
2830
type: type.trim(),
31+
module: module.trim(),
2932
content: content.trim(),
3033
};
3134
});
@@ -50,6 +53,7 @@ function backToBottom() {
5053
}
5154
5255
onActivated(() => {
56+
getConfig();
5357
onUpdate();
5458
5559
if (log.value) {
@@ -81,7 +85,28 @@ onDeactivated(() => {
8185
max-h-60vh
8286
min-h-20vh
8387
>
84-
<div min-w-450>
88+
<div v-if="logSetting.debug_enable" min-w-450>
89+
<template v-for="i in formatLog" :key="i.index">
90+
<div
91+
p="y-10"
92+
leading="1.5em"
93+
border="0 b-1 solid"
94+
last:border-b-0
95+
flex="~ items-center gap-20"
96+
:style="{ color: typeColor(i.type) }"
97+
>
98+
<div flex="~ col items-center gap-10" whitespace-nowrap>
99+
<div text="center">{{ i.type }}</div>
100+
<div>[{{ i.date }}]</div>
101+
</div>
102+
<div flex-1 break-all style="color: #73bccd">
103+
{{ i.module }}
104+
</div>
105+
<div flex-1 break-all>{{ i.content }}</div>
106+
</div>
107+
</template>
108+
</div>
109+
<div v-else min-w-450>
85110
<template v-for="i in formatLog" :key="i.index">
86111
<div
87112
p="y-10"

0 commit comments

Comments
 (0)