示例#1
0
func BenchmarkLog_formatting(b *testing.B) {
	err := log.SetOutputFile(os.DevNull)
	if err != nil {
		b.Fatalf("Could not set output file: %s", err)
	}
	log.SetLogLevel(log.LevelAll)
	for n := 0; n < b.N; n++ {
		log.Error("%s %d", "Hello", 1234)
	}
}
示例#2
0
func BenchmarkLog_basic(b *testing.B) {
	err := log.SetOutputFile(os.DevNull)
	if err != nil {
		b.Fatalf("Could not set output file: %s", err)
	}
	log.SetLogLevel(log.LevelAll)
	for n := 0; n < b.N; n++ {
		log.Error("Hello world")
	}
}
示例#3
0
func BenchmarkLog_struct(b *testing.B) {
	err := log.SetOutputFile(os.DevNull)
	if err != nil {
		b.Fatalf("Could not set output file: %s", err)
	}
	log.SetLogLevel(log.LevelAll)
	for n := 0; n < b.N; n++ {
		log.Error("%s %d %v", "Hello", 1234, struct{ s string }{"World"})
	}
}