Browse Source

241003-1726-Kim

EricKIm 1 month ago
parent
commit
2cfece9da3
1 changed files with 10 additions and 1 deletions
  1. 10 1
      etc/err-log.go

+ 10 - 1
etc/err-log.go

@@ -148,6 +148,15 @@ func CurrFuncName() string { // nㅣl 아님 경우만 처리(!!중요)
 	return s[strings.LastIndex(s, "/")+1:] + " "
 }
 
+func LogFuncName() string { // nㅣl 아님 경우만 처리(!!중요)
+	pc := make([]uintptr, 15)
+	n := runtime.Callers(2, pc)
+	frames := runtime.CallersFrames(pc[:n])
+	frame, _ := frames.Next()
+	s := frame.Function
+	return s[strings.LastIndex(s, "/")+1:] + " "
+}
+
 func LogCritical(index string, s string, err error) { //에러 ㄱ계를 추적
 	var errStr string
 	if err != nil {
@@ -202,7 +211,7 @@ func ErrLog(s string, err error) error { // // nㅣl처리 아주 중요함 ( 
 		log.Println("========= Fatal: error is nil ErrLog==========")
 	}
 
-	str := "[Error]: " + s + " (Err): " + errStr
+	str := "[Err]: " + s + " (Err): " + errStr
 	log.Println(str)
 	return errors.New(str)