Commit 01c86bd1 by zhengqiuyun86

mysql加入连接配置

parent 13557f1d
...@@ -50,6 +50,8 @@ func Info(msg string) { ...@@ -50,6 +50,8 @@ func Info(msg string) {
ok := false ok := false
switch strings.ToLower(conf.LogLevel) { switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo): case strings.ToLower(LevelInfo):
ok = true ok = true
break break
...@@ -64,7 +66,11 @@ func Warn(msg string) { ...@@ -64,7 +66,11 @@ func Warn(msg string) {
ok := false ok := false
switch strings.ToLower(conf.LogLevel) { switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo): case strings.ToLower(LevelInfo):
ok = true
break
case strings.ToLower(LevelWarn): case strings.ToLower(LevelWarn):
ok = true ok = true
break break
...@@ -79,8 +85,14 @@ func Error(msg string) { ...@@ -79,8 +85,14 @@ func Error(msg string) {
ok := false ok := false
switch strings.ToLower(conf.LogLevel) { switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true
break
case strings.ToLower(LevelInfo): case strings.ToLower(LevelInfo):
ok = true
break
case strings.ToLower(LevelWarn): case strings.ToLower(LevelWarn):
ok = true
break
case strings.ToLower(LevelError): case strings.ToLower(LevelError):
ok = true ok = true
break break
...@@ -111,15 +123,16 @@ func print(tag, msg string, file string, line int) { ...@@ -111,15 +123,16 @@ func print(tag, msg string, file string, line int) {
str := "%s %s [%d] %s %d %s" str := "%s %s [%d] %s %d %s"
if conf.LogColorful { if conf.LogColorful {
switch tag { switch tag {
case strings.ToLower(LevelDebug): case LevelDebug:
str = "%s %s [%d] %s %d " + green + "%s" + reset str = "%s %s [%d] %s %d " + green + "%s" + reset
break break
case strings.ToLower(LevelInfo): case LevelInfo:
break
case strings.ToLower(LevelWarn):
str = "%s %s [%d] %s %d " + yellow + "%s" + reset str = "%s %s [%d] %s %d " + yellow + "%s" + reset
break 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 str = "%s %s [%d] %s %d " + red + "%s" + reset
break break
} }
......
...@@ -3,16 +3,22 @@ package main ...@@ -3,16 +3,22 @@ package main
import ( import (
"git.168cad.top/zhengqiuyun/rym-util/conf" "git.168cad.top/zhengqiuyun/rym-util/conf"
"git.168cad.top/zhengqiuyun/rym-util/es" "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/mysqlrym"
"git.168cad.top/zhengqiuyun/rym-util/redis" "git.168cad.top/zhengqiuyun/rym-util/redis"
"git.168cad.top/zhengqiuyun/rym-util/router" "git.168cad.top/zhengqiuyun/rym-util/router"
) )
func main() { func main() {
log.Debug("测试")
log.Info("测试")
log.Warn("测试")
log.Error("测试")
conf.BaseConfig(conf.Config{ conf.BaseConfig(conf.Config{
ServerName: "rym-framework", ServerName: "rym-framework",
Env: "dev", Env: "dev",
HttpPort: 1024, HttpPort: 1024,
LogColorful: true,
}) })
mysqlrym.TestLog() mysqlrym.TestLog()
es.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