Skip to content

Commit

Permalink
Update logging_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
donnie4w committed Oct 1, 2024
1 parent 42eb6e2 commit 24a0ade
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions logger/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log/slog"
"path/filepath"
"strconv"
"sync"
"testing"
"time"
)
Expand Down Expand Up @@ -55,32 +54,6 @@ func Test_LogOne(t *testing.T) {
time.Sleep(2 * time.Second)
}

func BenchmarkSerialLog(b *testing.B) {
b.StopTimer()
log := NewLogger()
log.SetRollingFile(`./`, "log1.txt", 100, MB)
log.SetConsole(false)
// log.SetFormat(FORMAT_NANO)
b.StartTimer()
wg := sync.WaitGroup{}
for i := 0; i < 100; i++ {
wg.Add(1)

go func() {
for i := 0; i < b.N; i++ {
// log.Write([]byte(">>>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
log.Debug(i, ">>>this is debug message")
// log.Info(i, ">>>this is info message")
// log.Warn(i, ">>>this is warm message")
// log.log.Error(i, ">>>this is error message")
}
wg.Done()
}()
}
wg.Wait()

}

func TestSlog(t *testing.T) {
replace := func(groups []string, a slog.Attr) slog.Attr {
if a.Key == slog.SourceKey {
Expand Down

0 comments on commit 24a0ade

Please sign in to comment.