Commit
This commit is contained in:
45
utils/log.go
Normal file
45
utils/log.go
Normal 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
9
utils/time.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func FormateDate(date time.Time) string {
|
||||
return date.Format("06-01-02")
|
||||
}
|
||||
Reference in New Issue
Block a user