fix the log level
Showing
2 changed files
with
5 additions
and
1 deletions
| ... | @@ -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) | ... | ... |
-
Please register or sign in to post a comment