feat: refactor logs (#2555)

* feat: refactor logs

* chore: comments

* feat: add system logs

* feat: update shared logs
This commit is contained in:
Alex Inkin
2024-02-06 06:26:00 +04:00
committed by GitHub
parent 4410d7f195
commit 9a0ae549f6
33 changed files with 676 additions and 180 deletions

View File

@@ -0,0 +1,20 @@
import { Log } from '../types/api'
import { toLocalIsoString } from './to-local-iso-string'
const Convert = require('ansi-to-html')
const CONVERT = new Convert({
bg: 'transparent',
colors: { 4: 'Cyan' },
escapeXML: true,
})
export function convertAnsi(entries: readonly Log[]): string {
return entries
.map(
({ timestamp, message }) =>
`<b style="color: #FFF">${toLocalIsoString(
new Date(timestamp),
)}</b>&nbsp;&nbsp;${CONVERT.toHtml(message)}`,
)
.join('<br />')
}