Skip to content

Commit

Permalink
fix: log-level being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta committed Oct 17, 2022
1 parent 44e49a0 commit cd8931e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)\"
Expand Down
9 changes: 7 additions & 2 deletions apps/chat2/chat2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
Port(uint16(conf.tcpPort) + conf.portsShift),
Port(uint16(conf.udpPort) + conf.portsShift))
Expand Down
10 changes: 5 additions & 5 deletions waku.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -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, "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "waku/v2/node/", "-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"
Expand All @@ -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"
4 changes: 4 additions & 0 deletions waku/v2/node/wakunode2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,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
Expand Down

0 comments on commit cd8931e

Please sign in to comment.