github.com/dotlike13/wemix30_go@v1.8.23/swarm/log/log.go (about) 1 package log 2 3 import ( 4 l "github.com/ethereum/go-ethereum/log" 5 "github.com/ethereum/go-ethereum/metrics" 6 ) 7 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 14 // Warn is a convenient alias for log.Warn with stats 15 func Warn(msg string, ctx ...interface{}) { 16 metrics.GetOrRegisterCounter("warn", nil).Inc(1) 17 l.Output(msg, l.LvlWarn, CallDepth, ctx...) 18 } 19 20 // Error is a convenient alias for log.Error with stats 21 func Error(msg string, ctx ...interface{}) { 22 metrics.GetOrRegisterCounter("error", nil).Inc(1) 23 l.Output(msg, l.LvlError, CallDepth, ctx...) 24 } 25 26 // Crit is a convenient alias for log.Crit with stats 27 func Crit(msg string, ctx ...interface{}) { 28 metrics.GetOrRegisterCounter("crit", nil).Inc(1) 29 l.Output(msg, l.LvlCrit, CallDepth, ctx...) 30 } 31 32 // Info is a convenient alias for log.Info with stats 33 func Info(msg string, ctx ...interface{}) { 34 metrics.GetOrRegisterCounter("info", nil).Inc(1) 35 l.Output(msg, l.LvlInfo, CallDepth, ctx...) 36 } 37 38 // Debug is a convenient alias for log.Debug with stats 39 func Debug(msg string, ctx ...interface{}) { 40 metrics.GetOrRegisterCounter("debug", nil).Inc(1) 41 l.Output(msg, l.LvlDebug, CallDepth, ctx...) 42 } 43 44 // Trace is a convenient alias for log.Trace with stats 45 func Trace(msg string, ctx ...interface{}) { 46 metrics.GetOrRegisterCounter("trace", nil).Inc(1) 47 l.Output(msg, l.LvlTrace, CallDepth, ctx...) 48 }