You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Logkit/gokit_test.go

58 lines
949 B

6 years ago
package logkit
import (
"fmt"
"strconv"
"testing"
"time"
)
5 years ago
func init() {
6 years ago
}
5 years ago
6 years ago
func BenchmarkGoKit(b *testing.B) {
defer Exit()
SetPath("/")
_, err := Init(FIlE, "test", LevelDebug, true, BasePath)
fmt.Printf("===%s", err)
6 years ago
b.ResetTimer()
for i := 0; i < b.N; i++ {
Info("test " + strconv.FormatInt(int64(i), 10))
}
}
func TestInfo(t *testing.T) {
defer Exit()
fmt.Println("start")
6 years ago
for i := 0; i < 10; i++ {
6 years ago
go func(i int) {
6 years ago
Info("test " + strconv.FormatInt(int64(i), 10))
6 years ago
}(i)
}
fmt.Println("end")
time.Sleep(time.Second * 2)
//
//for i := 0; i< 1000 ; i++ {
// Info("test "+ strconv.FormatInt(int64(i), 10))
//}
time.Sleep(time.Second * 1)
Info("test 2")
time.Sleep(time.Second * 1)
Info("test 3")
}
6 years ago
func TestBuffer(t *testing.T) {
6 years ago
defer Exit()
//for i := 0 ; i < 1024; i++ {
// str += strconv.FormatInt(int64(i),10)
//}
Infof("test %s --- %s", "1", "23")
//Exit()
}
5 years ago
func TestFlag(t *testing.T) {
}