Files
renovate/lib/logger/problem-stream.ts
T
Michael Kriese e438887dfb build: lazy load and initialize logger (#41425)
* build: lazy load initialization modules

* build: lazy load and initialize logger

* chore: lint fix

* Update lib/constants/error-messages.ts

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>

* Apply suggestion

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>

---------

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-03-10 16:57:29 +00:00

37 lines
733 B
TypeScript

// Do not static import `bunyan` here!
import { Stream } from 'node:stream';
import type { BunyanRecord } from './types.ts';
export const excludeProps = ['pid', 'time', 'v', 'hostname'];
export class ProblemStream extends Stream {
private _problems: BunyanRecord[] = [];
readable: boolean;
writable: boolean;
constructor() {
super();
this.readable = false;
this.writable = true;
}
write(data: BunyanRecord): boolean {
const problem = { ...data };
for (const prop of excludeProps) {
delete problem[prop];
}
this._problems.push(problem);
return true;
}
getProblems(): BunyanRecord[] {
return this._problems;
}
clearProblems(): void {
this._problems = [];
}
}