chore: format logs

This commit is contained in:
JustSong
2023-06-22 10:59:01 +08:00
parent b86de464b5
commit 00151a0124
13 changed files with 36 additions and 34 deletions

View File

@@ -11,7 +11,7 @@ var GroupRatio = map[string]float64{
func GroupRatio2JSONString() string {
jsonBytes, err := json.Marshal(GroupRatio)
if err != nil {
SysError("Error marshalling model ratio: " + err.Error())
SysError("error marshalling model ratio: " + err.Error())
}
return string(jsonBytes)
}
@@ -24,7 +24,7 @@ func UpdateGroupRatioByJSONString(jsonStr string) error {
func GetGroupRatio(name string) float64 {
ratio, ok := GroupRatio[name]
if !ok {
SysError("Group ratio not found: " + name)
SysError("group ratio not found: " + name)
return 1
}
return ratio

View File

@@ -40,7 +40,7 @@ var ModelRatio = map[string]float64{
func ModelRatio2JSONString() string {
jsonBytes, err := json.Marshal(ModelRatio)
if err != nil {
SysError("Error marshalling model ratio: " + err.Error())
SysError("error marshalling model ratio: " + err.Error())
}
return string(jsonBytes)
}
@@ -53,7 +53,7 @@ func UpdateModelRatioByJSONString(jsonStr string) error {
func GetModelRatio(name string) float64 {
ratio, ok := ModelRatio[name]
if !ok {
SysError("Model ratio not found: " + name)
SysError("model ratio not found: " + name)
return 30
}
return ratio

View File

@@ -20,7 +20,7 @@ func InitRedisClient() (err error) {
SysLog("Redis is enabled")
opt, err := redis.ParseURL(os.Getenv("REDIS_CONN_STRING"))
if err != nil {
FatalLog(err)
FatalLog("failed to parse Redis connection string: " + err.Error())
}
RDB = redis.NewClient(opt)
@@ -28,13 +28,16 @@ func InitRedisClient() (err error) {
defer cancel()
_, err = RDB.Ping(ctx).Result()
if err != nil {
FatalLog("Redis ping test failed: " + err.Error())
}
return err
}
func ParseRedisOption() *redis.Options {
opt, err := redis.ParseURL(os.Getenv("REDIS_CONN_STRING"))
if err != nil {
panic(err)
FatalLog("failed to parse Redis connection string: " + err.Error())
}
return opt
}