github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/swarm/log/log.go (about) 1 2 //此源码被清华学神尹成大魔王专业翻译分析并修改 3 //尹成QQ77025077 4 //尹成微信18510341407 5 //尹成所在QQ群721929980 6 //尹成邮箱 yinc13@mails.tsinghua.edu.cn 7 //尹成毕业于清华大学,微软区块链领域全球最有价值专家 8 //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 9 package log 10 11 import ( 12 l "github.com/ethereum/go-ethereum/log" 13 "github.com/ethereum/go-ethereum/metrics" 14 ) 15 16 const ( 17 // 18 // 19 CallDepth = 1 20 ) 21 22 // 23 func Warn(msg string, ctx ...interface{}) { 24 metrics.GetOrRegisterCounter("warn", nil).Inc(1) 25 l.Output(msg, l.LvlWarn, CallDepth, ctx...) 26 } 27 28 // 29 func Error(msg string, ctx ...interface{}) { 30 metrics.GetOrRegisterCounter("error", nil).Inc(1) 31 l.Output(msg, l.LvlError, CallDepth, ctx...) 32 } 33 34 // 35 func Crit(msg string, ctx ...interface{}) { 36 metrics.GetOrRegisterCounter("crit", nil).Inc(1) 37 l.Output(msg, l.LvlCrit, CallDepth, ctx...) 38 } 39 40 // 41 func Info(msg string, ctx ...interface{}) { 42 metrics.GetOrRegisterCounter("info", nil).Inc(1) 43 l.Output(msg, l.LvlInfo, CallDepth, ctx...) 44 } 45 46 // 47 func Debug(msg string, ctx ...interface{}) { 48 metrics.GetOrRegisterCounter("debug", nil).Inc(1) 49 l.Output(msg, l.LvlDebug, CallDepth, ctx...) 50 } 51 52 // 53 func Trace(msg string, ctx ...interface{}) { 54 metrics.GetOrRegisterCounter("trace", nil).Inc(1) 55 l.Output(msg, l.LvlTrace, CallDepth, ctx...) 56 }