Skip to content

Commit

Permalink
Fix logging format (#87)
Browse files Browse the repository at this point in the history
* add shortLog for Address

* compile with trace logging to catch errors
  • Loading branch information
dryajov authored Nov 20, 2023
1 parent dd49854 commit a7f14bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions build.nims
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import std / [os, strutils, sequtils]

task testAll, "Run DHT tests":
exec "nim c -r tests/testAll.nim"
rmFile "./tests/testAll"

task test, "Run DHT tests":
# compile with trace logging to make sure it doesn't crash
exec "nim c -d:testsAll -d:chronicles_enabled=on -d:chronicles_log_level=TRACE tests/testAll.nim"
rmFile "./tests/testAll"
exec "nim c -r -d:testsAll --verbosity:0 tests/testAllParallel.nim"
rmFile "./tests/testAllParallel"

task testPart1, "Run DHT tests A":
exec "nim c -r -d:testsPart1 tests/testAllParallel.nim"
rmFile "./tests/testAllParallel"

task testPart2, "Run DHT tests B":
exec "nim c -r -d:testsPart2 tests/testAllParallel.nim"
rmFile "./tests/testAllParallel"

task coverage, "generates code coverage report":
var (output, exitCode) = gorgeEx("which lcov")
Expand Down
2 changes: 1 addition & 1 deletion codexdht/private/eth/p2p/discoveryv5/encoding.nim
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ proc decodeMessagePacket(c: var Codec, fromAddr: Address, nonce: AESGCMNonce,
if pt.isNone():
# Don't consider this an error, the session got probably removed at the
# peer's side and a random message is send.
# This might also be a cross-connect. Not deleteing key, as it might be
# This might also be a cross-connect. Not deleting key, as it might be
# needed later, depending on message order.
trace "Decrypting failed (invalid keys)", address = fromAddr
#c.sessions.del(srcId, fromAddr)
Expand Down
5 changes: 5 additions & 0 deletions codexdht/private/eth/p2p/discoveryv5/node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,8 @@ func shortLog*(nodes: seq[Node]): string =

result.add("]")
chronicles.formatIt(seq[Node]): shortLog(it)

func shortLog*(address: Address): string =
$address

chronicles.formatIt(Address): shortLog(it)

0 comments on commit a7f14bc

Please sign in to comment.