Browse Source

v1.3.2 增加 glogs.Debug 等直接方法

tags/v1.3.2
liangzy 4 years ago
parent
commit
c653a48667
1 changed files with 17 additions and 17 deletions
  1. +17
    -17
      README.md

+ 17
- 17
README.md View File

@@ -58,35 +58,35 @@ import (

func TestGetLogger(t *testing.T) {
// 新建 channel 大小为128 标识为nds 日志通道 , Get 的方法 默认带 console 和 file 输出
l := Get("nds", 128).SetAdapter(LevelAll, AdapterElasticSearch)
l := grlogs.Get("nds", 128).SetAdapter(LevelAll, AdapterElasticSearch)
l.Debug("我正在调试")
l.Critical("出错了")

// 复用 nds 的日志通道
Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
grlogs.Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
grlogs.Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))

// 新建 channel 大小为默认 标识为wifi 日志通道 , GetEs 的方法 默认带 console 和 file 和 elatisearch 输出
GetEs("wifi")
grlogs.GetEs("wifi")
for i := 0; i < 10; i++ {
Get("wifi").Warning("Warning")
Get("wifi").Warn("Warn")
Get("wifi").Debug("Debug")
Get("wifi").Error("Error")
Get("wifi").Notice("Notice")
Get("wifi").Info("Info")
Get("wifi").Alert("Alert")
grlogs.Get("wifi").Warning("Warning")
grlogs.Get("wifi").Warn("Warn")
grlogs.Get("wifi").Debug("Debug")
grlogs.Get("wifi").Error("Error")
grlogs.Get("wifi").Notice("Notice")
grlogs.Get("wifi").Info("Info")
grlogs.Get("wifi").Alert("Alert")
}

Get("wifi").Critical("neoweiwoewe")
}

func TestDropAdapter(t *testing.T) {
SetAdapter(LevelAll, AdapterAliLs)
DropAdapter(AdapterAliLs)
Informational(errors.New("he hello"))
SetAdapter(LevelAll, AdapterAliLs)
Debug(errors.New("he hello"))
CloseAll()
grlogs.SetAdapter(LevelAll, AdapterAliLs)
grlogs.DropAdapter(AdapterAliLs)
grlogs.Informational(errors.New("he hello"))
grlogs.SetAdapter(LevelAll, AdapterAliLs)
grlogs.Debug(errors.New("he hello"))
grlogs.CloseAll()
}
```

Loading…
Cancel
Save