Closed notzippy closed 7 years ago
I was embedding your logger and now have the issue were the logged line is incorrect - I could write my handler to replace the set record.CallPC but that is a second call to runtime.Callers - it would be simpler if this was changed like
func (l *logger) write(msg string, lvl Lvl, ctx []interface{}) { r := Record{ Time: time.Now(), Lvl: lvl, Msg: msg, Ctx: newContext(l.ctx, ctx), KeyNames: RecordKeyNames{ Time: timeKey, Msg: msgKey, Lvl: lvlKey, }, } - runtime.Callers(3, r.CallPC[:]) + runtime.Callers(l.CallSkip, r.CallPC[:]) l.h.Log(&r) }
that way the stack position could be adjusted
Sorry just saw PR #128 - that would work great..
I was embedding your logger and now have the issue were the logged line is incorrect - I could write my handler to replace the set record.CallPC but that is a second call to runtime.Callers - it would be simpler if this was changed like
that way the stack position could be adjusted