Fix pubsub CI logs (#861)

This commit is contained in:
Tanguy 2023-03-01 16:59:44 +01:00 committed by GitHub
parent ddeb7b3bd4
commit c1a3bd8fee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import ../config.nims
import strutils
import strutils, os
--threads:on
--d:metrics
@ -8,18 +8,20 @@ import strutils
--d:libp2p_protobuf_metrics
--d:libp2p_network_protocols_metrics
--d:libp2p_mplex_metrics
--skipParentCfg
# Only add chronicles param if the
# user didn't specify any
var hasChroniclesParam = false
for param in 0..<paramCount():
if "chronicles" in paramStr(param):
for param in 0..<system.paramCount():
if "chronicles" in system.paramStr(param):
hasChroniclesParam = true
if hasChroniclesParam:
echo "Since you specified chronicles params, TRACE won't be tested!"
else:
switch("import", "stublogger")
let modulePath = currentSourcePath.parentDir / "stublogger"
switch("import", modulePath)
switch("define", "chronicles_sinks=textlines[stdout],json[dynamic]")
switch("define", "chronicles_log_level=TRACE")
switch("define", "chronicles_runtime_filtering=TRUE")

9
tests/pubsub/config.nims Normal file
View File

@ -0,0 +1,9 @@
import strutils
proc hasSkipParentCfg: bool =
for param in 0..<paramCount():
if "skipParent" in paramStr(param):
return true
when hasSkipParentCfg():
import ../config.nims

View File

@ -1,10 +1,11 @@
import std/typetraits
import chronicles
when not defined(nimscript):
import std/typetraits
import chronicles
when defined(chronicles_runtime_filtering):
when defined(chronicles_runtime_filtering):
setLogLevel(INFO)
when defaultChroniclesStream.outputs.type.arity == 1:
when defaultChroniclesStream.outputs.type.arity == 1:
# Hide the json logs, they're just here to check if we compile
proc noOutput(logLevel: LogLevel, msg: LogOutputStr) = discard
defaultChroniclesStream.outputs[0].writer = noOutput