This commit is contained in:
fallen-angle
2022-01-17 17:38:08 +08:00
parent 0a5379c8f3
commit 2280679053
19 changed files with 283 additions and 19 deletions

45
utils/log.go Normal file
View File

@@ -0,0 +1,45 @@
package utils
import "nCovTrack-Backend/global"
func RequestLogInfo(args ...interface{}) {
logInfo("request", args...)
}
func RequestLogError(args ...interface{}) {
logError("request", args...)
}
func RequestLogWarn(args ...interface{}) {
logWarn("request", args...)
}
func RequestLogPanic(args ...interface{}) {
logPanic("request", args...)
}
func InitLogPanic(component string, args ...interface{}) {
args = append(args, "component", component)
logPanic("initialize", args...)
}
func InitLogInfo(component string, args ...interface{}) {
args = append(args, "component", component)
logInfo("initialize", args...)
}
func logInfo(msg string, args ...interface{}) {
global.Logger.Infow(msg, args...)
}
func logError(msg string, args ...interface{}) {
global.Logger.Errorw(msg, args...)
}
func logWarn(msg string, args ...interface{}) {
global.Logger.Warnw(msg, args...)
}
func logPanic(msg string, args ...interface{}) {
global.Logger.Panicw("", args...)
}

9
utils/time.go Normal file
View File

@@ -0,0 +1,9 @@
package utils
import (
"time"
)
func FormateDate(date time.Time) string {
return date.Format("06-01-02")
}