Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

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

Kailash Nadh4d74cf4520a8
diff --git a/frontend/src/assets/style.scss b/frontend/src/assets/style.scss
index d32104f4..61d2caf2 100644
--- a/frontend/src/assets/style.scss
+++ b/frontend/src/assets/style.scss
@@ -1117,6 +1117,9 @@ section.analytics {
margin-right: 5px;
user-select: auto;
}
+ .timestamp {
+ margin-right: 15px;
+ }
.line:hover {
background: $white-bis;
diff --git a/frontend/src/components/LogView.vue b/frontend/src/components/LogView.vue
index 7b554ee2..910de0a0 100644
--- a/frontend/src/components/LogView.vue
+++ b/frontend/src/components/LogView.vue
@@ -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',
diff --git a/frontend/src/views/Import.vue b/frontend/src/views/Import.vue
index d7db5792..b9ed1263 100644
--- a/frontend/src/views/Import.vue
+++ b/frontend/src/views/Import.vue
@@ -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');