log: better docs for log.Output and calldepth

This commit is contained in:
Anton Evangelatov 2018-06-08 16:08:26 +03:00
parent d8b75b445a
commit b841febbb8

View file

@ -61,7 +61,10 @@ func Crit(msg string, ctx ...interface{}) {
} }
// Output is a convenient alias for write, allowing for the modification of // Output is a convenient alias for write, allowing for the modification of
// the skip step (number of stack frames to skip) // the calldepth (number of stack frames to skip).
func Output(msg string, lvl Lvl, skip int, ctx ...interface{}) { // calldepth influences the reported line number of the log message.
root.write(msg, lvl, ctx, skip+skipLevel) // 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)
} }