36 lines
665 B
Go
36 lines
665 B
Go
|
|
package logUtilPlus
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestWrite(t *testing.T) {
|
||
|
|
Start("http://10.254.0.242:9200", "20008_gs_log", 20008)
|
||
|
|
|
||
|
|
InfoLog("日志测试")
|
||
|
|
WarnLog("日志测试")
|
||
|
|
DebugLog("日志测试")
|
||
|
|
ErrorLog("日志测试")
|
||
|
|
FatalLog("日志测试")
|
||
|
|
|
||
|
|
time.Sleep(1 * time.Second)
|
||
|
|
Stop()
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkWrite(b *testing.B) {
|
||
|
|
Start("http://10.254.0.242:9200", "20008_gs_log", 20008)
|
||
|
|
b.ResetTimer()
|
||
|
|
for i := 0; i < b.N; i++ {
|
||
|
|
InfoLog("日志测试%d", i)
|
||
|
|
WarnLog("日志测试%d", i)
|
||
|
|
DebugLog("日志测试%d", i)
|
||
|
|
ErrorLog("日志测试%d", i)
|
||
|
|
FatalLog("日志测试%d", i)
|
||
|
|
}
|
||
|
|
b.StopTimer()
|
||
|
|
|
||
|
|
time.Sleep(1 * time.Second)
|
||
|
|
Stop()
|
||
|
|
}
|