71149218 by astaxie

fix the log level

1 parent 1636a727
...@@ -277,6 +277,7 @@ func init() { ...@@ -277,6 +277,7 @@ func init() {
277 if err != nil { 277 if err != nil {
278 fmt.Println("init console log error:", err) 278 fmt.Println("init console log error:", err)
279 } 279 }
280 BeeLogger.SetLogFuncCallDepth(true)
280 281
281 err = ParseConfig() 282 err = ParseConfig()
282 if err != nil && !os.IsNotExist(err) { 283 if err != nil && !os.IsNotExist(err) {
......
...@@ -154,7 +154,10 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error { ...@@ -154,7 +154,10 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error {
154 lm := new(logMsg) 154 lm := new(logMsg)
155 lm.level = loglevel 155 lm.level = loglevel
156 if bl.enableFuncCallDepth { 156 if bl.enableFuncCallDepth {
157 _, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth) 157 _, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth + 1)
158 if !ok {
159 _, file, line, ok = runtime.Caller(bl.loggerFuncCallDepth)
160 }
158 if ok { 161 if ok {
159 _, filename := path.Split(file) 162 _, filename := path.Split(file)
160 lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg) 163 lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!