Files
nCovTrack-Backend/utils/log.go
fallen-angle 582807ae10 Commit
2022-01-20 16:49:37 +08:00

53 lines
1.2 KiB
Go

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 InitLogError(component string, args ...interface{}) {
args = append(args, "component", component)
logError("initialize", args...)
}
func InitLogInfo(component string, args ...interface{}) {
args = append(args, "component", component)
logInfo("initialize", args...)
}
func UtilLogInfo(utilName string, args ...interface{}) {
args = append(args, "util", utilName)
logInfo("util", args...)
}
func UtilLogError(utilName string, args ...interface{}) {
args = append(args, "util", utilName)
logError("util", args...)
}
func UtilLogWarn(utilName string, args ...interface{}) {
args = append(args, "util", utilName)
logWarn("util", 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...)
}