goProject/.svn/pristine/43/43f852c1515a55d48e5d25081f9210b9da4ff66c.svn-base
2025-01-06 16:21:36 +08:00

36 lines
755 B
Plaintext

package esLogUtil
import (
"testing"
"time"
)
func TestWrite(t *testing.T) {
Start("http://10.1.0.86:9200", "dzg_gs_log_gmc2", 20008)
for i := 0; i < 10000; i++ {
InfoLog("ES在线日志测试")
WarnLog("ES在线日志测试")
DebugLog("ES在线日志测试")
ErrorLog("ES在线日志测试")
FatalLog("ES在线日志测试")
}
Stop()
}
func BenchmarkWrite(b *testing.B) {
Start("http://106.52.100.147:14001", "20008_gs_log", 20008)
b.ResetTimer()
for i := 0; i < b.N; i++ {
InfoLog("ES在线日志测试%d", i)
WarnLog("ES在线日志测试%d", i)
DebugLog("ES在线日志测试%d", i)
ErrorLog("ES在线日志测试%d", i)
FatalLog("ES在线日志测试%d", i)
}
b.StopTimer()
time.Sleep(30 * time.Second)
Stop()
}