Fix logging format (#87)

* add shortLog for Address

* compile with trace logging to catch errors
This commit is contained in:
Dmitriy Ryajov 2023-11-20 11:34:40 -06:00 committed by GitHub
parent dd4985435a
commit a7f14bc9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -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")

View File

@ -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)

View File

@ -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)