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

35 lines
588 B
Go

package log
import (
"os"
"testing"
"time"
)
func TestLogger(t *testing.T) {
stdout := New(os.Stdout)
stdout.SetTimeLayout("15:04:05.999")
stdout.SetName("main")
stdout.SetLevel(DEBUG)
stdout.EnableColorizedLevel(true)
stdout.EnableGoroutineId(true)
for i := 0; i < 3; i++ {
go func(i int) {
stdout.Debug("i = %d", i)
stdout.Info("i = %d", i)
}(i)
}
for i := 0; i < 3; i++ {
go func(i int) {
stdout.Debug("i = %d", i)
stdout.Info("i = %d", i)
}(i)
}
stdout.Warn("warning")
stdout.Error("error")
stdout.Fatal("fatal")
time.Sleep(1 * time.Second)
}