Skip to content

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

Display filename and milliseconds in timestamp on the logs admin UI (#2280)

Sávio Ribeiro2f5ab4c619e3
diff --git a/frontend/src/assets/style.scss b/frontend/src/assets/style.scss
index a33fa82a..1856e7aa 100644
--- a/frontend/src/assets/style.scss
+++ b/frontend/src/assets/style.scss
@@ -973,11 +973,12 @@ section.analytics {
margin-bottom: 2px;
}
- .timestamp {
+ .timestamp, .file {
color: $primary;
display: inline-block;
min-width: 175px;
margin-right: 5px;
+ user-select: auto;
}
.line:hover {
diff --git a/frontend/src/components/LogView.vue b/frontend/src/components/LogView.vue
index ac7ddab4..f2212afd 100644
--- a/frontend/src/components/LogView.vue
+++ b/frontend/src/components/LogView.vue
@@ -4,7 +4,8 @@
<div class="lines" ref="lines">
<template v-for="(l, i) in lines">
<span :set="line = splitLine(l)" :key="i" class="line">
- <span class="timestamp" :title="line.file">{{ line.timestamp }}</span>
+ <span class="timestamp">{{ line.timestamp }}&nbsp;</span>
+ <span class="file">{{ line.file }}:&nbsp;</span>
<span class="log-message">{{ line.message }}</span>
</span>
</template>
@@ -15,8 +16,8 @@
<script>
// Regexp for splitting log lines in the following format to
// [timestamp] [file] [message].
-// 2021/05/01 00:00:00 init.go:99: reading config: config.toml
-const reFormatLine = /^([0-9\s:/]+) (.+?\.go:[0-9]+):\s/g;
+// 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(.+)$/;
export default {
name: 'LogView',