瀏覽代碼

240927-0015-Kim

EricKIm 1 月之前
父節點
當前提交
7c80400c35
共有 2 個文件被更改,包括 21 次插入13 次删除
  1. 20 12
      etc/err-log.go
  2. 1 1
      structs.go

+ 20 - 12
etc/err-log.go

@@ -37,15 +37,15 @@ func InitLog(path string, showstdout string) error {
 }
 
 func PageCntErr(index string, tablename string) string {
-	return LogStr(index, " Count Query Error "+tablename+" ")
+	return ErrStr(index, " Count Query Error "+tablename+" ")
 }
 
 func PageRead(index string, tablename string) string {
-	return LogStr(index, " Page Read from "+tablename+" ")
+	return ErrStr(index, " Page Read from "+tablename+" ")
 }
 
 func PageQryErr(index string, tablename string) string {
-	return LogStr(index, " Page Query Error "+tablename+" ")
+	return ErrStr(index, " Page Query Error "+tablename+" ")
 }
 
 func RecRead(index string, msgString string) string {
@@ -57,7 +57,7 @@ func RecNotFound(index string, msgString string) string {
 }
 
 func RecReadErr(index string, msgString string) string {
-	return LogStr(index, " B error in Reading "+msgString+" ")
+	return ErrStr(index, " B error in Reading "+msgString+" ")
 }
 
 func RecAdded(index string, msgString string) string {
@@ -69,7 +69,7 @@ func RecNotAdded(index string, msgString string) string {
 }
 
 func RecAddErr(index string, msgString string) string {
-	return LogStr(index, " DB error in Adding "+msgString+" ")
+	return ErrStr(index, " DB error in Adding "+msgString+" ")
 }
 
 func RecEdited(index string, msgString string) string {
@@ -81,7 +81,7 @@ func RecNotEdited(index string, msgString string) string {
 }
 
 func RecEditErr(index string, msgString string) string {
-	return LogStr(index, " DB error in Editing "+msgString+" ")
+	return ErrStr(index, " DB error in Editing "+msgString+" ")
 }
 
 func RecDeleted(index string, msgString string) string {
@@ -97,15 +97,23 @@ func RecDelErr(index string, msgString string) string {
 }
 
 func FuncRun(index string, funcname string) string {
-	return LogStr(index, " Function Run from "+funcname+" ")
+	return LogStr(index, " Func : "+funcname+" ")
 }
 
 func FuncRunErr(index string, funcname string) string {
-	return LogStr(index, " Function Run Error in "+funcname+" ")
+	return ErrStr(index, " Func->"+funcname+" ")
 }
 
 func JsonFormatErr(index string, structname string) string {
-	return LogStr(index, " Json Format mismatches in "+structname+" ")
+	return ErrStr(index, " Json Format mismatches in "+structname+" ")
+}
+
+func ErrStr(index string, s string) string { // nㅣl 아님 경우만 처리(!!중요)
+	msg := s
+	str := index + " @ " + msg
+	log.Println("[Err]: " + str)
+
+	return msg
 }
 
 func LogStr(index string, s string) string { // nㅣl 아님 경우만 처리(!!중요)
@@ -125,7 +133,7 @@ func LogErr(index string, s string, err error) error { // nㅣl 아님 경우만
 	}
 	msg := s + " * " + errStr
 	str := index + " @ " + msg
-	log.Println("[Cnd]: " + str)
+	log.Println("[Err]: " + str)
 	return errors.New(msg)
 }
 
@@ -134,9 +142,9 @@ func CurrFuncName() string { // nㅣl 아님 경우만 처리(!!중요)
 	n := runtime.Callers(2, pc)
 	frames := runtime.CallersFrames(pc[:n])
 	frame, _ := frames.Next()
+	fmt.Printf("ErrPath: %s:%d %s\n", frame.File, frame.Line, frame.Function)
+	// fmt.Println("Lastindex:", s[strings.LastIndex(s, "/")+1:])
 	s := frame.Function
-	// fmt.Println(s[strings.LastIndex(s, "/")+1:])
-	// fmt.Printf("%s:%d %s\n", frame.File, frame.Line, frame.Function)
 	return s[strings.LastIndex(s, "/")+1:] + " "
 }
 

+ 1 - 1
structs.go

@@ -67,7 +67,7 @@ type AbangoAccess struct {
 	DbConnStr string
 }
 
-// !!!여기를 수정할 경우 (1)UpdateGtb (2)MemberLogin (3)MemberLogin 을 수정해야 한다.
+// !!!여기를 수정할 경우 (1)UpdateGtb (2)MemberLogin (3)MemberSsoLogin 을 수정해야 한다.
 type GateTokenBase struct {
 	ConnStr         string `yaml:"conn_str"` //Only from Custom.yml
 	ConnString      string //RealConnection String