fix: log-level being ignored (#1272)

This commit is contained in:
Alvaro Revuelta 2022-10-18 18:03:43 -05:00 committed by GitHub
parent 757804c9ee
commit df6d215424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View File

@ -103,6 +103,9 @@ endif
# use a separate waku discv5 network with `protocol-id="d5waku"`
NIM_PARAMS := $(NIM_PARAMS) -d:discv5_protocol_id:d5waku
# enable runtime log-level filtering (see setLogLevel)
NIM_PARAMS := $(NIM_PARAMS) -d:chronicles_runtime_filtering:on
# git version for JSON RPC call
GIT_VERSION ?= $(shell git describe --abbrev=6 --always --tags)
NIM_PARAMS := $(NIM_PARAMS) -d:git_version:\"$(GIT_VERSION)\"

View File

@ -363,10 +363,15 @@ proc readInput(wfd: AsyncFD) {.thread, raises: [Defect, CatchableError].} =
{.pop.} # @TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError
proc processInput(rfd: AsyncFD) {.async.} =
let transp = fromPipe(rfd)
let
transp = fromPipe(rfd)
conf = Chat2Conf.load()
# set log level
if conf.logLevel != LogLevel.NONE:
setLogLevel(conf.logLevel)
let
conf = Chat2Conf.load()
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
Port(uint16(conf.tcpPort) + conf.portsShift),
Port(uint16(conf.udpPort) + conf.portsShift))

View File

@ -426,6 +426,10 @@ when isMainModule:
if conf.version:
echo "version / git commit hash: ", git_version
quit(QuitSuccess)
# set log level
if conf.logLevel != LogLevel.NONE:
setLogLevel(conf.logLevel)
var
node: WakuNode # This is the node we're going to setup using the conf

View File

@ -65,11 +65,11 @@ task test1, "Build & run Waku v1 tests":
### Waku v2 tasks
task wakunode2, "Build Waku v2 (experimental) cli node":
let name = "wakunode2"
buildBinary name, "apps/wakunode2/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "apps/wakunode2/", "-d:chronicles_log_level=TRACE"
task bridge, "Build Waku v1 - v2 bridge":
let name = "wakubridge"
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=TRACE"
task test2, "Build & run Waku v2 tests":
test "all_tests_v2"
@ -96,14 +96,14 @@ task chat2, "Build example Waku v2 chat usage":
#buildBinary name, "examples/v2/", "-d:chronicles_log_level=WARN"
let name = "chat2"
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=DEBUG -d:chronicles_sinks=textlines[file] -d:ssl"
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[file] -d:ssl"
task chat2bridge, "Build chat2bridge":
let name = "chat2bridge"
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=TRACE"
### Waku Tooling
task wakucanary, "Build waku-canary tool":
let name = "wakucanary"
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=DEBUG -d:chronicles_runtime_filtering:on"
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=TRACE"