From d11afdacde17f5d5515cdf7039a5a8fb0b8c89f1 Mon Sep 17 00:00:00 2001 From: Anubhav Mishra Date: Fri, 3 Jul 2020 14:49:10 -0700 Subject: [PATCH] only turn on logging when env is set to true --- packages/cdktf-cli/bin/cdktf.ts | 2 +- packages/cdktf-cli/lib/logging.ts | 2 +- test/run-against-dist | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/cdktf-cli/bin/cdktf.ts b/packages/cdktf-cli/bin/cdktf.ts index 4d728c7270..aeb24c6dc9 100644 --- a/packages/cdktf-cli/bin/cdktf.ts +++ b/packages/cdktf-cli/bin/cdktf.ts @@ -12,7 +12,7 @@ const args = yargs .epilogue(`Options can be specified via environment variables with the "CDKTF_" prefix (e.g. "CDKTF_OUTPUT")`) .help() .alias('h', 'help') - .option('disable-logging', { type: 'boolean', default: false, required: false, desc: 'Dont write log files'}) + .option('disable-logging', { type: 'boolean', default: true, required: false, desc: 'Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING.'}) .option('log-level', { type: 'string', required: false, desc: 'Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL'}) .argv; diff --git a/packages/cdktf-cli/lib/logging.ts b/packages/cdktf-cli/lib/logging.ts index d7077f2981..b136efc7a2 100644 --- a/packages/cdktf-cli/lib/logging.ts +++ b/packages/cdktf-cli/lib/logging.ts @@ -4,7 +4,7 @@ const logger = getLogger(); logger.level = process.env.CDKTF_LOG_LEVEL || 'INFO'; -if (process.env.CDKTF_DISABLE_LOGGING === undefined) { +if (process.env.CDKTF_DISABLE_LOGGING === 'false') { configure({ appenders: { cdktf: { type: "file", filename: "./cdktf.log" } }, categories: { default: { appenders: ["cdktf"], level: "debug" } } diff --git a/test/run-against-dist b/test/run-against-dist index aab16ab9e4..e75bc24945 100755 --- a/test/run-against-dist +++ b/test/run-against-dist @@ -3,7 +3,6 @@ set -euo pipefail scriptdir=$(cd $(dirname $0) && pwd) export CDKTF_DIST="${scriptdir}/../dist" -export CDKTF_DISABLE_LOGGING=1 cwd=$PWD cd ${CDKTF_DIST}