Commit 01c86bd1 by zhengqiuyun86

mysql加入连接配置

parent 13557f1d
......@@ -50,6 +50,8 @@ func Info(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo):
ok = true
break
......@@ -64,7 +66,11 @@ func Warn(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo):
ok = true
break
case strings.ToLower(LevelWarn):
ok = true
break
......@@ -79,8 +85,14 @@ func Error(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo):
ok = true
break
case strings.ToLower(LevelWarn):
ok = true
break
case strings.ToLower(LevelError):
ok = true
break
......@@ -111,15 +123,16 @@ func print(tag, msg string, file string, line int) {
str := "%s %s [%d] %s %d %s"
if conf.LogColorful {
switch tag {
case strings.ToLower(LevelDebug):
case LevelDebug:
str = "%s %s [%d] %s %d " + green + "%s" + reset
break
case strings.ToLower(LevelInfo):
break
case strings.ToLower(LevelWarn):
case LevelInfo:
str = "%s %s [%d] %s %d " + yellow + "%s" + reset
break
case strings.ToLower(LevelError):
case LevelWarn:
str = "%s %s [%d] %s %d " + magenta + "%s" + reset
break
case LevelError:
str = "%s %s [%d] %s %d " + red + "%s" + reset
break
}
......
......@@ -3,16 +3,22 @@ package main
import (
"git.168cad.top/zhengqiuyun/rym-util/conf"
"git.168cad.top/zhengqiuyun/rym-util/es"
"git.168cad.top/zhengqiuyun/rym-util/log"
"git.168cad.top/zhengqiuyun/rym-util/mysqlrym"
"git.168cad.top/zhengqiuyun/rym-util/redis"
"git.168cad.top/zhengqiuyun/rym-util/router"
)
func main() {
log.Debug("测试")
log.Info("测试")
log.Warn("测试")
log.Error("测试")
conf.BaseConfig(conf.Config{
ServerName: "rym-framework",
Env: "dev",
HttpPort: 1024,
ServerName: "rym-framework",
Env: "dev",
HttpPort: 1024,
LogColorful: true,
})
mysqlrym.TestLog()
es.TestLog()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment