Skip to content

Commit

Permalink
Merge pull request #819 from lochjin/dev2.0
Browse files Browse the repository at this point in the history
BUG:location trims repeat when set log level
  • Loading branch information
dindinw authored Oct 28, 2024
2 parents faef4f3 + 1423945 commit 8670c06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func init() {

glogger.Verbosity(LvlInfo)

LocationTrims = append(LocationTrims, "github.com/Qitmeer/qng/")
AddLocationPrefix("github.com/Qitmeer/qng/")
}

// initLogRotator initializes the logging rotater to write logs to logFile and
Expand Down Expand Up @@ -116,3 +116,12 @@ func LogAndMeasureExecutionTime(log Logger, functionName string) (onEnd func())
log.Trace(fmt.Sprintf("%s end. Took: %s", functionName, time.Since(start)))
}
}

func AddLocationPrefix(prefix string) {
for _, pf := range LocationTrims {
if prefix == pf {
return
}
}
LocationTrims = append(LocationTrims, prefix)
}
2 changes: 1 addition & 1 deletion meerevm/eth/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func InitLog(DebugLevel string, DebugPrintOrigins bool) {
agentTH.lvl = lvl
}
glogger.Verbosity(log.FromLegacyLevel(int(lvl)))
qlog.LocationTrims = append(qlog.LocationTrims, "github.com/ethereum/go-ethereum/")
qlog.AddLocationPrefix("github.com/ethereum/go-ethereum/")
}

type agentTerminalHandler struct {
Expand Down

0 comments on commit 8670c06

Please sign in to comment.