Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
Use proper .textContent to show log (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagmat84 authored Sep 20, 2022
1 parent ab0f314 commit 75e260e
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions scripts/main/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1972,23 +1972,25 @@ view.logs = {
" UTC"
);
};
const html =
logEntries.reduce(function (acc, logEntry) {
return (
acc +
formatDateTime(new Date(logEntry.created_at)) +
" -- " +
logEntry.type.padEnd(7) +
" -- " +
logEntry.function +
" -- " +
logEntry.line +
" -- " +
logEntry.text +
"\n"
);
}, "<pre>") + "</pre>";
$(".logs_diagnostics_view").html(html);
const preformattedLog = logEntries.reduce(function (acc, logEntry) {
return (
acc +
formatDateTime(new Date(logEntry.created_at)) +
" -- " +
logEntry.type.padEnd(7) +
" -- " +
logEntry.function +
" -- " +
logEntry.line +
" -- " +
logEntry.text +
"\n"
);
}, "");
/** @type {HTMLDivElement} */
const logView = document.querySelector(".logs_diagnostics_view");
logView.replaceChildren();
logView.appendChild(document.createElement("pre")).textContent = preformattedLog;
};

view.logs.clearContent();
Expand Down

0 comments on commit 75e260e

Please sign in to comment.