From 0c69b6ed6410f547fa3629f8922fc6dd90fac3d1 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Sat, 15 Feb 2020 14:07:43 +0100 Subject: [PATCH] improvement(cli): output error details to console with log level 5 --- garden-service/src/cli/cli.ts | 11 ++++++++--- garden-service/src/task-graph.ts | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/garden-service/src/cli/cli.ts b/garden-service/src/cli/cli.ts index da447183f5..56e21a829f 100644 --- a/garden-service/src/cli/cli.ts +++ b/garden-service/src/cli/cli.ts @@ -54,6 +54,7 @@ import stringify = require("json-stringify-safe") import { generateBasicDebugInfoReport } from "../commands/get/get-debug-info" import { AnalyticsHandler } from "../analytics/analytics" import { defaultDotIgnoreFiles } from "../util/fs" +import { renderError } from "../logger/renderers" const OUTPUT_RENDERERS = { json: (data: DeepPrimitiveMap) => { @@ -449,12 +450,16 @@ export class GardenCli { } if (gardenErrors.length > 0) { - gardenErrors.forEach((error) => - logger.error({ + for (const error of gardenErrors) { + const entry = logger.error({ msg: error.message, error, }) - ) + // Output error details to console when log level is silly + logger.silly({ + msg: renderError(entry), + }) + } if (logger.writers.find((w) => w instanceof FileWriter)) { logger.info(`\nSee ${ERROR_LOG_FILENAME} for detailed error message`) diff --git a/garden-service/src/task-graph.ts b/garden-service/src/task-graph.ts index 7541591d87..8c800d6f93 100644 --- a/garden-service/src/task-graph.ts +++ b/garden-service/src/task-graph.ts @@ -19,6 +19,7 @@ import { Garden } from "./garden" import { dedent } from "./util/string" import uuid from "uuid" import { defer, relationshipClasses } from "./util/util" +import { renderError } from "./logger/renderers" class TaskGraphError extends GardenBaseError { type = "task-graph" @@ -532,7 +533,8 @@ export class TaskGraph { (hasAnsi(errorMessage) ? errorMessage : chalk.red(errorMessage)) + chalk.red.bold(`\n${divider}\n`) - this.log.error({ msg, error }) + const entry = this.log.error({ msg, error }) + this.log.silly({ msg: renderError(entry) }) } }