Commit c07f2cdc by yemin

no message

parent 06e703bc
...@@ -14,4 +14,4 @@ type LogConfig struct { ...@@ -14,4 +14,4 @@ type LogConfig struct {
LogIndexNamePrefix string LogIndexNamePrefix string
} }
var LogConf = LogConfig{"Debug", true, 0, true, ""} var Conf = LogConfig{"Debug", true, 0, true, ""}
...@@ -24,7 +24,7 @@ func DebugDo(f func()) { ...@@ -24,7 +24,7 @@ func DebugDo(f func()) {
func IsDebug() bool { func IsDebug() bool {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -34,7 +34,7 @@ func IsDebug() bool { ...@@ -34,7 +34,7 @@ func IsDebug() bool {
func Debugf(format string, msg ...interface{}) { func Debugf(format string, msg ...interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -47,7 +47,7 @@ func Debugf(format string, msg ...interface{}) { ...@@ -47,7 +47,7 @@ func Debugf(format string, msg ...interface{}) {
func Debug(msg interface{}) { func Debug(msg interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -60,7 +60,7 @@ func Debug(msg interface{}) { ...@@ -60,7 +60,7 @@ func Debug(msg interface{}) {
func Infof(format string, msg ...interface{}) { func Infof(format string, msg ...interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -76,7 +76,7 @@ func Infof(format string, msg ...interface{}) { ...@@ -76,7 +76,7 @@ func Infof(format string, msg ...interface{}) {
func Info(msg interface{}) { func Info(msg interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -92,7 +92,7 @@ func Info(msg interface{}) { ...@@ -92,7 +92,7 @@ func Info(msg interface{}) {
func Warnf(format string, msg ...interface{}) { func Warnf(format string, msg ...interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -111,7 +111,7 @@ func Warnf(format string, msg ...interface{}) { ...@@ -111,7 +111,7 @@ func Warnf(format string, msg ...interface{}) {
func Warn(msg interface{}) { func Warn(msg interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -130,7 +130,7 @@ func Warn(msg interface{}) { ...@@ -130,7 +130,7 @@ func Warn(msg interface{}) {
func Errorf(format string, msg ...interface{}) { func Errorf(format string, msg ...interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -152,7 +152,7 @@ func Errorf(format string, msg ...interface{}) { ...@@ -152,7 +152,7 @@ func Errorf(format string, msg ...interface{}) {
func Error(msg interface{}) { func Error(msg interface{}) {
ok := false ok := false
switch strings.ToLower(LogConf.LogLevel) { switch strings.ToLower(Conf.LogLevel) {
case strings.ToLower(LevelDebug): case strings.ToLower(LevelDebug):
ok = true ok = true
break break
...@@ -190,7 +190,7 @@ const ( ...@@ -190,7 +190,7 @@ const (
func print(tag, file string, line int, msg interface{}) { func print(tag, file string, line int, msg interface{}) {
str := "%s %s [%d] %s %d %s" str := "%s %s [%d] %s %d %s"
if LogConf.LogColorful { if Conf.LogColorful {
switch tag { switch tag {
case LevelDebug: case LevelDebug:
str = "%s %s [%d] %s %d " + green + "%s" + reset str = "%s %s [%d] %s %d " + green + "%s" + reset
......
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