Tweak log viewer to optionally hide filename from log lines (on the import UI).

This commit is contained in:
Kailash Nadh 2025-08-03 19:17:41 +05:30
parent 26c61f8ea1
commit 4d74cf4520
3 changed files with 6 additions and 4 deletions

View file

@ -1117,6 +1117,9 @@ section.analytics {
margin-right: 5px;
user-select: auto;
}
.timestamp {
margin-right: 15px;
}
.line:hover {
background: $white-bis;

View file

@ -6,7 +6,7 @@
<template v-if="l">
<span :set="line = splitLine(l)" :key="i" class="line">
<span class="timestamp">{{ line.timestamp }}&nbsp;</span>
<span class="file">{{ line.file }}:&nbsp;</span>
<span v-if="line.file !== '*'" class="file">{{ line.file }}:&nbsp;</span>
<span class="log-message">{{ line.message }}</span>
</span>
</template>
@ -19,7 +19,7 @@
// Regexp for splitting log lines in the following format to
// [timestamp] [file] [message].
// 2021/05/01 00:00:00:00 init.go:99: reading config: config.toml
const reFormatLine = /^([0-9\s:/]+\.[0-9]{6}) (.+?\.go:[0-9]+):\s(.+)$/;
const reFormatLine = /^([0-9\s:/]+\.[0-9]{6}) (.+?\.go:[0-9]+|\*):\s(.+)$/;
export default {
name: 'LogView',

View file

@ -256,8 +256,7 @@ export default Vue.extend({
getLogs() {
this.$api.getImportLogs().then((data) => {
this.logs = data.split('\n');
this.logs = data.split('\n').map((line) => line.replace(/\s+importer\.go:\d+:\s*/, ' *: '));
Vue.nextTick(() => {
// vue.$refs doesn't work as the logs textarea is rendered dynamically.
const ref = document.getElementById('import-log');