mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-24 22:48:06 +00:00
e438887dfb
* 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>
37 lines
733 B
TypeScript
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 = [];
|
|
}
|
|
}
|