aboutsummaryrefslogtreecommitdiffstats
path: root/log/logger.go
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-06-14 17:21:17 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-06-14 17:21:17 +0800
commit1836366ac19e30f157570e61342fae53bc6c8a57 (patch)
treea95b5027602d17315cd6462f7c08ac4123c9099d /log/logger.go
parent591cef17d4f1700de50057fd6988b9731a2195c9 (diff)
downloaddexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.gz
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.bz2
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.lz
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.xz
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.zst
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.zip
all: library changes for swarm-network-rewrite (#16898)
This commit adds all changes needed for the merge of swarm-network-rewrite. The changes: - build: increase linter timeout - contracts/ens: export ensNode - log: add Output method and enable fractional seconds in format - metrics: relax test timeout - p2p: reduced some log levels, updates to simulation packages - rpc: increased maxClientSubscriptionBuffer to 20000
Diffstat (limited to 'log/logger.go')
-rw-r--r--log/logger.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/log/logger.go b/log/logger.go
index a2fe6dc58..438aa548f 100644
--- a/log/logger.go
+++ b/log/logger.go
@@ -12,6 +12,7 @@ const timeKey = "t"
const lvlKey = "lvl"
const msgKey = "msg"
const errorKey = "LOG15_ERROR"
+const skipLevel = 2
type Lvl int
@@ -127,13 +128,13 @@ type logger struct {
h *swapHandler
}
-func (l *logger) write(msg string, lvl Lvl, ctx []interface{}) {
+func (l *logger) write(msg string, lvl Lvl, ctx []interface{}, skip int) {
l.h.Log(&Record{
Time: time.Now(),
Lvl: lvl,
Msg: msg,
Ctx: newContext(l.ctx, ctx),
- Call: stack.Caller(2),
+ Call: stack.Caller(skip),
KeyNames: RecordKeyNames{
Time: timeKey,
Msg: msgKey,
@@ -157,27 +158,27 @@ func newContext(prefix []interface{}, suffix []interface{}) []interface{} {
}
func (l *logger) Trace(msg string, ctx ...interface{}) {
- l.write(msg, LvlTrace, ctx)
+ l.write(msg, LvlTrace, ctx, skipLevel)
}
func (l *logger) Debug(msg string, ctx ...interface{}) {
- l.write(msg, LvlDebug, ctx)
+ l.write(msg, LvlDebug, ctx, skipLevel)
}
func (l *logger) Info(msg string, ctx ...interface{}) {
- l.write(msg, LvlInfo, ctx)
+ l.write(msg, LvlInfo, ctx, skipLevel)
}
func (l *logger) Warn(msg string, ctx ...interface{}) {
- l.write(msg, LvlWarn, ctx)
+ l.write(msg, LvlWarn, ctx, skipLevel)
}
func (l *logger) Error(msg string, ctx ...interface{}) {
- l.write(msg, LvlError, ctx)
+ l.write(msg, LvlError, ctx, skipLevel)
}
func (l *logger) Crit(msg string, ctx ...interface{}) {
- l.write(msg, LvlCrit, ctx)
+ l.write(msg, LvlCrit, ctx, skipLevel)
os.Exit(1)
}