Skip to content

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

Fix broken log rendering on importer UI.

Kailash Nadh0be7a79dacbb
diff --git a/frontend/src/components/LogView.vue b/frontend/src/components/LogView.vue
index f2212afd..7b554ee2 100644
--- a/frontend/src/components/LogView.vue
+++ b/frontend/src/components/LogView.vue
@@ -3,11 +3,13 @@
<b-loading :active="loading" :is-full-page="false" />
<div class="lines" ref="lines">
<template v-for="(l, i) in lines">
- <span :set="line = splitLine(l)" :key="i" class="line">
- <span class="timestamp">{{ line.timestamp }}&nbsp;</span>
- <span class="file">{{ line.file }}:&nbsp;</span>
- <span class="log-message">{{ line.message }}</span>
- </span>
+ <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 class="log-message">{{ line.message }}</span>
+ </span>
+ </template>
</template>
</div>
</section>
@@ -33,6 +35,14 @@ export default {
methods: {
splitLine: (l) => {
const parts = l.split(reFormatLine);
+ if (parts.length !== 5) {
+ return {
+ timestamp: '',
+ file: '',
+ message: l,
+ };
+ }
+
return {
timestamp: parts[1],
file: parts[2],
diff --git a/frontend/src/views/Import.vue b/frontend/src/views/Import.vue
index b5e75d4c..51f95a8c 100644
--- a/frontend/src/views/Import.vue
+++ b/frontend/src/views/Import.vue
@@ -167,7 +167,7 @@ export default Vue.extend({
isProcessing: false,
status: { status: '' },
- logs: '',
+ logs: [],
pollID: null,
};
},
diff --git a/internal/subimporter/importer.go b/internal/subimporter/importer.go
index 6ace3236..973ce678 100644
--- a/internal/subimporter/importer.go
+++ b/internal/subimporter/importer.go
@@ -172,7 +172,7 @@ func (im *Importer) NewSession(opt SessionOpt) (*Session, error) {
s := &Session{
im: im,
- log: log.New(im.status.logBuf, "", log.Ldate|log.Ltime|log.Lshortfile),
+ log: log.New(im.status.logBuf, "", log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile),
subQueue: make(chan SubReq, commitBatchSize),
opt: opt,
}