Skip to content

Commit

Permalink
Merge pull request #1723 from OffchainLabs/system_test_loglevel
Browse files Browse the repository at this point in the history
system_tests: increase log level with env variable
  • Loading branch information
PlasmaPower authored Aug 11, 2023
2 parents 0245520 + 35d9eef commit 4225c4d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"fmt"
"math/big"
"net"
"os"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -39,6 +41,7 @@ import (
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
Expand Down Expand Up @@ -904,3 +907,18 @@ func deploySimple(
Require(t, err)
return addr, simple
}

func TestMain(m *testing.M) {
logLevelEnv := os.Getenv("TEST_LOGLEVEL")
if logLevelEnv != "" {
logLevel, err := strconv.ParseUint(logLevelEnv, 10, 32)
if err != nil || logLevel > uint64(log.LvlTrace) {
log.Warn("TEST_LOGLEVEL exists but out of bound, ignoring", "logLevel", logLevelEnv, "max", log.LvlTrace)
}
glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
glogger.Verbosity(log.Lvl(logLevel))
log.Root().SetHandler(glogger)
}
code := m.Run()
os.Exit(code)
}

0 comments on commit 4225c4d

Please sign in to comment.