Browse Source

v1.2.0 整个beegolog 打进去, 增加syncmap日志通道

tags/v1.2.2
liangzy 4 years ago
parent
commit
7cb5ecc181
2 changed files with 4 additions and 4 deletions
  1. +1
    -2
      log.go
  2. +3
    -2
      log_test.go

+ 1
- 2
log.go View File

@@ -75,7 +75,6 @@ func GetLogger(name string) *Logger {
} }


wd, _ := os.Getwd() wd, _ := os.Getwd()
fmt.Println(wd)


conf1 := FileLogConfig{ conf1 := FileLogConfig{
Filename: path.Join(wd, fmt.Sprintf("runtime/logs/%s.log", name)), Filename: path.Join(wd, fmt.Sprintf("runtime/logs/%s.log", name)),
@@ -94,7 +93,7 @@ func GetLogger(name string) *Logger {
confString, _ := json.Marshal(&conf1) confString, _ := json.Marshal(&conf1)
confString2, _ := json.Marshal(&conf2) confString2, _ := json.Marshal(&conf2)
l := new(Logger) l := new(Logger)
l.BeeLogger = logs.NewLogger()
l.BeeLogger = logs.NewLogger(1000)
l.SetLogger(logs.AdapterFile, bytes.NewBuffer(confString).String()) l.SetLogger(logs.AdapterFile, bytes.NewBuffer(confString).String())
l.SetLogger(logs.AdapterConsole, bytes.NewBuffer(confString2).String()) l.SetLogger(logs.AdapterConsole, bytes.NewBuffer(confString2).String())
l.BeeLogger.SetPrefix("_" + name) l.BeeLogger.SetPrefix("_" + name)


+ 3
- 2
log_test.go View File

@@ -5,7 +5,8 @@ import (
) )


func TestGetLogger(t *testing.T) { func TestGetLogger(t *testing.T) {
GetLogger("nds").Debug("我正在调试")
GetLogger("nds").Critical("出错了")
l := GetLogger("nds")
l.Debug("我正在调试")
l.Critical("出错了")
GetLogger("wifi").Critical("hello wifi") GetLogger("wifi").Critical("hello wifi")
} }

Loading…
Cancel
Save