@@ -78,3 +78,21 @@ func TestNew(t *testing.T) { | |||||
wg.Wait() | wg.Wait() | ||||
} | } | ||||
func TestGetEs(t *testing.T) { | |||||
wg := sync.WaitGroup{} | |||||
for i := 0; i < 10; i++ { | |||||
wg.Add(1) | |||||
go func(i int) { | |||||
GetEs("ok").Debug("%d", i) | |||||
time.Sleep(time.Second * 10) | |||||
wg.Done() | |||||
}(i) | |||||
} | |||||
for i := 0; i < 10; i++ { | |||||
GetEs("ok").Debug("aaaaaa%d", i) | |||||
} | |||||
wg.Wait() | |||||
} |
@@ -89,7 +89,7 @@ func (el *esLogger) WriteMsg(when time.Time, msg string, level int, lable string | |||||
d := goes.Document{ | d := goes.Document{ | ||||
Index: fmt.Sprintf("%s-%04d.%02d.%02d", el.IndexName, when.Year(), when.Month(), when.Day()), | Index: fmt.Sprintf("%s-%04d.%02d.%02d", el.IndexName, when.Year(), when.Month(), when.Day()), | ||||
Type: "logs", | |||||
Type: "_doc", | |||||
Fields: vals, | Fields: vals, | ||||
} | } | ||||
_, err := el.Index(d, nil) | _, err := el.Index(d, nil) | ||||
@@ -281,7 +281,7 @@ func testFileRotate(t *testing.T, fn1, fn2 string, daily, hourly bool) { | |||||
fw.hourlyOpenDate = fw.hourlyOpenTime.Day() | fw.hourlyOpenDate = fw.hourlyOpenTime.Day() | ||||
} | } | ||||
fw.WriteMsg(time.Now(), "this is a msg for test", LevelDebug) | |||||
fw.WriteMsg(time.Now(), "this is a msg for test", LevelDebug, "", "dev") | |||||
for _, file := range []string{fn1, fn2} { | for _, file := range []string{fn1, fn2} { | ||||
_, err := os.Stat(file) | _, err := os.Stat(file) | ||||