@@ -5,38 +5,44 @@ import (
55 "github.com/ethereum/go-ethereum/metrics"
66)
77
8+ const (
9+ // CallDepth is set to 1 in order to influence to reported line number of
10+ // the log message with 1 skipped stack frame of calling l.Output()
11+ CallDepth = 1
12+ )
13+
814// Warn is a convenient alias for log.Warn with stats
915func Warn (msg string , ctx ... interface {}) {
1016 metrics .GetOrRegisterCounter ("warn" , nil ).Inc (1 )
11- l .Output (msg , l .LvlWarn , 3 , ctx ... )
17+ l .Output (msg , l .LvlWarn , CallDepth , ctx ... )
1218}
1319
1420// Error is a convenient alias for log.Error with stats
1521func Error (msg string , ctx ... interface {}) {
1622 metrics .GetOrRegisterCounter ("error" , nil ).Inc (1 )
17- l .Output (msg , l .LvlError , 3 , ctx ... )
23+ l .Output (msg , l .LvlError , CallDepth , ctx ... )
1824}
1925
2026// Crit is a convenient alias for log.Crit with stats
2127func Crit (msg string , ctx ... interface {}) {
2228 metrics .GetOrRegisterCounter ("crit" , nil ).Inc (1 )
23- l .Output (msg , l .LvlCrit , 3 , ctx ... )
29+ l .Output (msg , l .LvlCrit , CallDepth , ctx ... )
2430}
2531
2632// Info is a convenient alias for log.Info with stats
2733func Info (msg string , ctx ... interface {}) {
2834 metrics .GetOrRegisterCounter ("info" , nil ).Inc (1 )
29- l .Output (msg , l .LvlInfo , 3 , ctx ... )
35+ l .Output (msg , l .LvlInfo , CallDepth , ctx ... )
3036}
3137
3238// Debug is a convenient alias for log.Debug with stats
3339func Debug (msg string , ctx ... interface {}) {
3440 metrics .GetOrRegisterCounter ("debug" , nil ).Inc (1 )
35- l .Output (msg , l .LvlDebug , 3 , ctx ... )
41+ l .Output (msg , l .LvlDebug , CallDepth , ctx ... )
3642}
3743
3844// Trace is a convenient alias for log.Trace with stats
3945func Trace (msg string , ctx ... interface {}) {
4046 metrics .GetOrRegisterCounter ("trace" , nil ).Inc (1 )
41- l .Output (msg , l .LvlTrace , 3 , ctx ... )
47+ l .Output (msg , l .LvlTrace , CallDepth , ctx ... )
4248}
0 commit comments