-
Notifications
You must be signed in to change notification settings - Fork 0
/
console_test.go
34 lines (30 loc) · 889 Bytes
/
console_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package logkit
import (
"log"
"testing"
"time"
)
func TestNewConsoleTarget(t *testing.T) {
logKit := NewLogKitByOptions(WithCallStackDepth(0), WithBuffer(1024), WithTargets(NewConsoleTarget()))
err := logKit.Open()
if err != nil {
log.Fatal(err)
}
defer logKit.Close()
logKit.Error("Message, current time: %d",time.Now().Nanosecond())
// for i := 0; i <= 10000; i++ {
// logKit.Error("Message %d, current time: %d", i, time.Now().Nanosecond())
// }
}
func BenchmarkNewConsoleTarget(b *testing.B) {
logKit := NewLogKitByOptions(WithCallStackDepth(0), WithBuffer(1024), WithTargets(NewConsoleTarget()))
err := logKit.Open()
if err != nil {
log.Fatal(err)
}
defer logKit.Close()
logKit.Error("Message, current time: %d",time.Now().Nanosecond())
// for i := 0; i <= 10000; i++ {
// logKit.Error("Message %d, current time: %d", i, time.Now().Nanosecond())
// }
}