Cope with multiline logs
This commit is contained in:
parent
a53062af83
commit
24060b6d2a
2 changed files with 17 additions and 7 deletions
|
|
@ -86,7 +86,7 @@ export default {
|
||||||
this.modalNotify(`Background image has been updated`);
|
this.modalNotify(`Background image has been updated`);
|
||||||
},
|
},
|
||||||
alertImageLabel(r) {
|
alertImageLabel(r) {
|
||||||
let label = r.output===true? 'sample' : 'background'
|
let label = r.output === true ? "sample" : "background";
|
||||||
this.modalNotify(`Current image is ${label}`);
|
this.modalNotify(`Current image is ${label}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,12 +141,22 @@ export default {
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
if (line.length > 0) {
|
if (line.length > 0) {
|
||||||
let m = line.match(regexp);
|
let m = line.match(regexp);
|
||||||
this.logs.push({
|
if (m) {
|
||||||
timestamp: m[1],
|
this.logs.push({
|
||||||
level: m[2],
|
timestamp: m[1],
|
||||||
message: m[3],
|
level: m[2],
|
||||||
sequence: this.logs.length
|
message: m[3],
|
||||||
});
|
sequence: this.logs.length
|
||||||
|
});
|
||||||
|
} else if (this.logs) {
|
||||||
|
// If a line does not look like a log entry, append it to the last
|
||||||
|
// log entry (i.e. allow multi-line messages)
|
||||||
|
this.logs[this.logs.length - 1].message += "\n" + line;
|
||||||
|
} else {
|
||||||
|
// if there's no existing log message to append to, discard lines
|
||||||
|
// until we find one.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue