Skip to content

Commit

Permalink
Simplify Error.cause logging (#6669)
Browse files Browse the repository at this point in the history
- Errors from "request" package (and thus the "@kubernetes/client-node"
  package too) contain a "response" field which is very large and has
  redundent information on it

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
  • Loading branch information
Nokel81 authored Dec 13, 2022
1 parent 012944d commit 4d58219
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/logger/console-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LEVEL, MESSAGE, SPLAT } from "triple-beam";
import chalk from "chalk";
import type { InspectOptions } from "util";
import { inspect } from "util";
import { omit } from "lodash";

// The following license was copied from https://github.com/duccio/winston-console-format/blob/master/LICENSE
// This was modified to support formatting causes
Expand Down Expand Up @@ -112,8 +113,8 @@ export class ConsoleFormat {
const messages: string[] = [];

if (source instanceof Error && source.cause) {
messages.push(`Cause: ${source.cause}`);
messages.push(...this.getLines(source.cause).map(l => ` ${l}`));
messages.push("Cause:");
messages.push(...this.getLines(omit(source.cause, "response")).map(l => ` ${l}`));
messages.push(...this._cause(source.cause));
}

Expand Down

0 comments on commit 4d58219

Please sign in to comment.