samba/pkg/log/log_test.go
2025-06-04 09:51:39 +08:00

22 lines
381 B
Go

package log
import (
"fmt"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"testing"
)
func testLogger(t *testing.T) {
Open("test.log", int(DebugLevel))
defer Close()
fields := []zapcore.Field{zap.String("name", "liu")}
Info("hello %v", fields...)
Warn(fmt.Sprintf("warn %v", fields))
Error(fmt.Sprintf("hi %v", fields))
}
func TestLogger(t *testing.T) {
testLogger(t)
}