22 lines
381 B
Go
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)
|
||
|
}
|