Support grouped system log messages (#5030)

* Support grouped system log messages

* Format source
This commit is contained in:
Paulus Schoutsen 2020-03-03 13:55:26 -08:00 committed by GitHub
parent aa2e632df3
commit 54739c7ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 8 deletions

View File

@ -2,9 +2,9 @@ import { HomeAssistant } from "../types";
export interface LoggedError { export interface LoggedError {
name: string; name: string;
message: string; message: [string];
level: string; level: string;
source: string; source: [string, number];
// unix timestamp in seconds // unix timestamp in seconds
timestamp: number; timestamp: number;
exception: string; exception: string;

View File

@ -54,7 +54,8 @@ class DialogSystemLogDetail extends LitElement {
</h2> </h2>
<paper-dialog-scrollable> <paper-dialog-scrollable>
<p> <p>
Logger: ${item.name} Logger: ${item.name}<br />
Source: ${item.source.join(":")}
${integration ${integration
? html` ? html`
<br /> <br />
@ -81,11 +82,18 @@ class DialogSystemLogDetail extends LitElement {
Last logged: Last logged:
${formatSystemLogTime(item.timestamp, this.hass!.language)} ${formatSystemLogTime(item.timestamp, this.hass!.language)}
</p> </p>
${item.message ${item.message.length > 1
? html` ? html`
<pre>${item.message}</pre> <ul>
${item.message.map(
(msg) =>
html`
<li>${msg}</li>
`
)}
</ul>
` `
: html``} : item.message[0]}
${item.exception ${item.exception
? html` ? html`
<pre>${item.exception}</pre> <pre>${item.exception}</pre>

View File

@ -62,7 +62,7 @@ export class SystemLogCard extends LitElement {
<paper-item @click=${this._openLog} .logItem=${item}> <paper-item @click=${this._openLog} .logItem=${item}>
<paper-item-body two-line> <paper-item-body two-line>
<div class="row"> <div class="row">
${item.message} ${item.message[0]}
</div> </div>
<div secondary> <div secondary>
${formatSystemLogTime( ${formatSystemLogTime(
@ -75,7 +75,7 @@ export class SystemLogCard extends LitElement {
this.hass!.localize, this.hass!.localize,
integrations[idx]! integrations[idx]!
) )
: item.source} : item.source[0]}
(${item.level}) (${item.level})
${item.count > 1 ${item.count > 1
? html` ? html`