Skip to content

Commit

Permalink
Merge pull request #64 from defenseunicorns/63_explict_error_log_sift
Browse files Browse the repository at this point in the history
chore: catch & log errors during log sift()
  • Loading branch information
cmwylie19 authored Sep 10, 2024
2 parents 6c3b9ed + d52c973 commit 22aa92b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions _helpers/src/pepr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ import { cwd } from 'node:process';
import { readFile } from 'node:fs/promises';

function sift(stdout) {
const parsed = stdout
.filter(l => l !== '')
.map(l => JSON.parse(l))
.filter(l => l)
.filter(l => l.url !== "/healthz")
.filter(l => l.msg !== "Pepr Store update")
.filter(l => l.name !== "/kube-root-ca.crt")
try {
const parsed = stdout
.filter(l => l !== '')
.map(l => JSON.parse(l))
.filter(l => l)
.filter(l => l.url !== "/healthz")
.filter(l => l.msg !== "Pepr Store update")
.filter(l => l.name !== "/kube-root-ca.crt")

parsed.sort((l, r) => l.time - r.time)

parsed.sort((l, r) => l.time - r.time)
return parsed.map(l => JSON.stringify(l))

return parsed.map(l => JSON.stringify(l))
} catch (e) {
console.log(stdout);
console.error(e);
}
}

export async function logs() {
Expand Down

0 comments on commit 22aa92b

Please sign in to comment.