Compare commits
No commits in common. "master" and "v1.3.5" have entirely different histories.
@ -80,14 +80,14 @@ func GenAliConfig(level Level) *AliLSConfig {
|
||||
}
|
||||
|
||||
func GenEsConfig(level Level) *EsConfig {
|
||||
dsn := "http://es-cn-tl32xlfmu00015h34.public.elasticsearch.aliyuncs.com:9200/"
|
||||
dsn := "http://es-cn-0pp1mm3hq000dnbh4.public.elasticsearch.aliyuncs.com:9200/"
|
||||
if os.Getenv(envkey) == "prod" || os.Getenv(envkey) == "" || os.Getenv(envkey) == "gray" {
|
||||
dsn = "http://es-cn-tl32xlfmu00015h34.elasticsearch.aliyuncs.com:9200/"
|
||||
dsn = "http://es-cn-0pp1mm3hq000dnbh4.elasticsearch.aliyuncs.com:9200/"
|
||||
}
|
||||
|
||||
c := &EsConfig{
|
||||
Username: "kaifa_api",
|
||||
Password: "2quYX3bTeahO",
|
||||
Username: "elastic",
|
||||
Password: "Hellogaore@",
|
||||
Dsn: dsn,
|
||||
Level: level,
|
||||
Index: os.Getenv("GRLOG_APP_NAME"),
|
||||
|
18
log_test.go
18
log_test.go
@ -78,21 +78,3 @@ func TestNew(t *testing.T) {
|
||||
|
||||
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{
|
||||
Index: fmt.Sprintf("%s-%04d.%02d.%02d", el.IndexName, when.Year(), when.Month(), when.Day()),
|
||||
Type: "_doc",
|
||||
Type: "logs",
|
||||
Fields: vals,
|
||||
}
|
||||
_, 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.WriteMsg(time.Now(), "this is a msg for test", LevelDebug, "", "dev")
|
||||
fw.WriteMsg(time.Now(), "this is a msg for test", LevelDebug)
|
||||
|
||||
for _, file := range []string{fn1, fn2} {
|
||||
_, err := os.Stat(file)
|
||||
|
Loading…
Reference in New Issue
Block a user