github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/swarm/log/log.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 12:09:47</date> 10 //</624342671678246912> 11 12 package log 13 14 import ( 15 l "github.com/ethereum/go-ethereum/log" 16 "github.com/ethereum/go-ethereum/metrics" 17 ) 18 19 const ( 20 // 21 // 22 CallDepth = 1 23 ) 24 25 // 26 func Warn(msg string, ctx ...interface{}) { 27 metrics.GetOrRegisterCounter("warn", nil).Inc(1) 28 l.Output(msg, l.LvlWarn, CallDepth, ctx...) 29 } 30 31 // 32 func Error(msg string, ctx ...interface{}) { 33 metrics.GetOrRegisterCounter("error", nil).Inc(1) 34 l.Output(msg, l.LvlError, CallDepth, ctx...) 35 } 36 37 // 38 func Crit(msg string, ctx ...interface{}) { 39 metrics.GetOrRegisterCounter("crit", nil).Inc(1) 40 l.Output(msg, l.LvlCrit, CallDepth, ctx...) 41 } 42 43 // 44 func Info(msg string, ctx ...interface{}) { 45 metrics.GetOrRegisterCounter("info", nil).Inc(1) 46 l.Output(msg, l.LvlInfo, CallDepth, ctx...) 47 } 48 49 // 50 func Debug(msg string, ctx ...interface{}) { 51 metrics.GetOrRegisterCounter("debug", nil).Inc(1) 52 l.Output(msg, l.LvlDebug, CallDepth, ctx...) 53 } 54 55 // 56 func Trace(msg string, ctx ...interface{}) { 57 metrics.GetOrRegisterCounter("trace", nil).Inc(1) 58 l.Output(msg, l.LvlTrace, CallDepth, ctx...) 59 } 60