make testnetX: propagate LOG_LEVEL to beacon_node runtime [skip ci]

This allows running `make LOG_LEVEL=TRACE testnet1` and having that log
level also enabled at runtime, not just at compile time.
This commit is contained in:
Stefan Talpalaru 2020-02-08 00:57:48 +01:00
parent 521b0ed6ba
commit 7feaa11372
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 8 additions and 2 deletions

View File

@ -114,10 +114,10 @@ clean-testnet1:
rm -rf build/data/testnet1
testnet0: | build deps
NIM_PARAMS="$(NIM_PARAMS)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims testnet0
NIM_PARAMS="$(NIM_PARAMS)" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims testnet0
testnet1: | build deps
NIM_PARAMS="$(NIM_PARAMS)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims testnet1
NIM_PARAMS="$(NIM_PARAMS)" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims testnet1
clean: | clean-common
rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_testnet*,state_sim,transition*}

View File

@ -131,11 +131,17 @@ cli do (testnetName {.argument.}: string):
echo "\nDeposit sent, wait for confirmation then press enter to continue"
discard readLineFromStdin()
let logLevel = getEnv("LOG_LEVEL")
var logLevelOpt = ""
if logLevel.len > 0:
logLevelOpt = "--log-level=" & logLevel
mode = Verbose
execIgnoringExitCode replace(&"""{beaconNodeBinary}
--data-dir="{dataDir}"
--dump=true
--web3-url={web3Url}
{bootstrapFileOpt}
{logLevelOpt}
--state-snapshot="{testnetDir/genesisFile}" """ & depositContractOpt, "\n", " ")