forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
48 lines (40 loc) · 1.43 KB
/
log.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package log
import (
l "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
)
const (
// CallDepth is set to 1 in order to influence to reported line number of
// the log message with 1 skipped stack frame of calling l.Output()
CallDepth = 1
)
// Warn is a convenient alias for log.Warn with stats
func Warn(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("warn", nil).Inc(1)
l.Output(msg, l.LvlWarn, CallDepth, ctx...)
}
// Error is a convenient alias for log.Error with stats
func Error(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("error", nil).Inc(1)
l.Output(msg, l.LvlError, CallDepth, ctx...)
}
// Crit is a convenient alias for log.Crit with stats
func Crit(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("crit", nil).Inc(1)
l.Output(msg, l.LvlCrit, CallDepth, ctx...)
}
// Info is a convenient alias for log.Info with stats
func Info(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("info", nil).Inc(1)
l.Output(msg, l.LvlInfo, CallDepth, ctx...)
}
// Debug is a convenient alias for log.Debug with stats
func Debug(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("debug", nil).Inc(1)
l.Output(msg, l.LvlDebug, CallDepth, ctx...)
}
// Trace is a convenient alias for log.Trace with stats
func Trace(msg string, ctx ...interface{}) {
metrics.GetOrRegisterCounter("trace", nil).Inc(1)
l.Output(msg, l.LvlTrace, CallDepth, ctx...)
}