pull/455/head
Gordon 2 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 0a36ff7eec
commit d914eb92d4

@ -7,6 +7,7 @@
package log package log
import ( import (
"Open_IM/pkg/utils"
"fmt" "fmt"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"runtime" "runtime"
@ -25,6 +26,7 @@ func (f *fileHook) Levels() []logrus.Level {
func (f *fileHook) Fire(entry *logrus.Entry) error { func (f *fileHook) Fire(entry *logrus.Entry) error {
entry.Data["FilePath"] = findCaller(6) entry.Data["FilePath"] = findCaller(6)
utils.GetSelfFuncName()
return nil return nil
} }
@ -56,7 +58,7 @@ func getCaller(skip int) (string, int) {
if !ok { if !ok {
return "", 0 return "", 0
} }
fmt.Println("skip:", skip, "file:", file, "line", line)
n := 0 n := 0
for i := len(file) - 1; i > 0; i-- { for i := len(file) - 1; i > 0; i-- {
if file[i] == '/' { if file[i] == '/' {

Loading…
Cancel
Save