c8f6e0f1 by astaxie

remove the hardcode in runtime.Caller

1 parent 0207caab
...@@ -157,15 +157,12 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error { ...@@ -157,15 +157,12 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error {
157 lm.level = loglevel 157 lm.level = loglevel
158 if bl.enableFuncCallDepth { 158 if bl.enableFuncCallDepth {
159 _, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth) 159 _, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
160 if _, filename := path.Split(file); filename == "log.go" && (line == 97 || line == 83) { 160 if !ok {
161 _, file, line, ok = runtime.Caller(bl.loggerFuncCallDepth + 1) 161 file = "???"
162 } 162 line = 0
163 if ok {
164 _, filename := path.Split(file)
165 lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
166 } else {
167 lm.msg = msg
168 } 163 }
164 _, filename := path.Split(file)
165 lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
169 } else { 166 } else {
170 lm.msg = msg 167 lm.msg = msg
171 } 168 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!