2021-02-17 17:14:47 +08:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
2021-03-14 15:36:00 +08:00
|
|
|
"os"
|
2021-02-17 17:14:47 +08:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2021-05-01 01:15:30 +08:00
|
|
|
func TestInfo(t *testing.T) {
|
|
|
|
logger := DefaultLogger
|
2021-05-17 16:34:28 +08:00
|
|
|
logger = With(logger, "ts", DefaultTimestamp, "caller", DefaultCaller)
|
|
|
|
logger.Log(LevelInfo, "key1", "value1")
|
2021-02-17 17:14:47 +08:00
|
|
|
}
|
2021-03-14 15:36:00 +08:00
|
|
|
|
|
|
|
func TestWrapper(t *testing.T) {
|
|
|
|
out := NewStdLogger(os.Stdout)
|
|
|
|
err := NewStdLogger(os.Stderr)
|
|
|
|
|
2021-05-17 16:34:28 +08:00
|
|
|
l := With(MultiLogger(out, err), "ts", DefaultTimestamp, "caller", DefaultCaller)
|
|
|
|
l.Log(LevelInfo, "msg", "test")
|
2021-03-14 15:36:00 +08:00
|
|
|
}
|