Skip to content

Commit 1423945

Browse files
committed
BUG:location trims repeat when set level
1 parent f098bb6 commit 1423945

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

log/log.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func init() {
7676

7777
glogger.Verbosity(LvlInfo)
7878

79-
LocationTrims = append(LocationTrims, "github.com/Qitmeer/qng/")
79+
AddLocationPrefix("github.com/Qitmeer/qng/")
8080
}
8181

8282
// initLogRotator initializes the logging rotater to write logs to logFile and
@@ -116,3 +116,12 @@ func LogAndMeasureExecutionTime(log Logger, functionName string) (onEnd func())
116116
log.Trace(fmt.Sprintf("%s end. Took: %s", functionName, time.Since(start)))
117117
}
118118
}
119+
120+
func AddLocationPrefix(prefix string) {
121+
for _, pf := range LocationTrims {
122+
if prefix == pf {
123+
return
124+
}
125+
}
126+
LocationTrims = append(LocationTrims, prefix)
127+
}

meerevm/eth/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func InitLog(DebugLevel string, DebugPrintOrigins bool) {
4444
agentTH.lvl = lvl
4545
}
4646
glogger.Verbosity(log.FromLegacyLevel(int(lvl)))
47-
qlog.LocationTrims = append(qlog.LocationTrims, "github.com/ethereum/go-ethereum/")
47+
qlog.AddLocationPrefix("github.com/ethereum/go-ethereum/")
4848
}
4949

5050
type agentTerminalHandler struct {

0 commit comments

Comments
 (0)