aboutsummaryrefslogtreecommitdiffstats
path: root/log/root.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/root.go
parent591cef17d4f1700de50057fd6988b9731a2195c9 (diff)
downloadgo-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar
go-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar.gz
go-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar.bz2
go-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar.lz
go-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar.xz
go-tangerine-1836366ac19e30f157570e61342fae53bc6c8a57.tar.zst
go-tangerine-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/root.go')
-rw-r--r--log/root.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/log/root.go b/log/root.go
index 71b8cef6d..9fb4c5ae0 100644
--- a/log/root.go
+++ b/log/root.go
@@ -31,31 +31,40 @@ func Root() Logger {
// Trace is a convenient alias for Root().Trace
func Trace(msg string, ctx ...interface{}) {
- root.write(msg, LvlTrace, ctx)
+ root.write(msg, LvlTrace, ctx, skipLevel)
}
// Debug is a convenient alias for Root().Debug
func Debug(msg string, ctx ...interface{}) {
- root.write(msg, LvlDebug, ctx)
+ root.write(msg, LvlDebug, ctx, skipLevel)
}
// Info is a convenient alias for Root().Info
func Info(msg string, ctx ...interface{}) {
- root.write(msg, LvlInfo, ctx)
+ root.write(msg, LvlInfo, ctx, skipLevel)
}
// Warn is a convenient alias for Root().Warn
func Warn(msg string, ctx ...interface{}) {
- root.write(msg, LvlWarn, ctx)
+ root.write(msg, LvlWarn, ctx, skipLevel)
}
// Error is a convenient alias for Root().Error
func Error(msg string, ctx ...interface{}) {
- root.write(msg, LvlError, ctx)
+ root.write(msg, LvlError, ctx, skipLevel)
}
// Crit is a convenient alias for Root().Crit
func Crit(msg string, ctx ...interface{}) {
- root.write(msg, LvlCrit, ctx)
+ root.write(msg, LvlCrit, ctx, skipLevel)
os.Exit(1)
}
+
+// Output is a convenient alias for write, allowing for the modification of
+// the calldepth (number of stack frames to skip).
+// calldepth influences the reported line number of the log message.
+// A calldepth of zero reports the immediate caller of Output.
+// Non-zero calldepth skips as many stack frames.
+func Output(msg string, lvl Lvl, calldepth int, ctx ...interface{}) {
+ root.write(msg, lvl, ctx, calldepth+skipLevel)
+}