From b841febbb8e4b943b0dde81dfa090c734953fa74 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Fri, 8 Jun 2018 16:08:26 +0300 Subject: [PATCH] log: better docs for log.Output and calldepth --- log/root.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/log/root.go b/log/root.go index 486c54861f..9fb4c5ae0b 100644 --- a/log/root.go +++ b/log/root.go @@ -61,7 +61,10 @@ func Crit(msg string, ctx ...interface{}) { } // Output is a convenient alias for write, allowing for the modification of -// the skip step (number of stack frames to skip) -func Output(msg string, lvl Lvl, skip int, ctx ...interface{}) { - root.write(msg, lvl, ctx, skip+skipLevel) +// 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) }