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"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLogger(t *testing.T) {
|
2021-02-22 17:50:43 +08:00
|
|
|
logger := DefaultLogger
|
2021-02-17 17:14:47 +08:00
|
|
|
Debug(logger).Print("log", "test debug")
|
|
|
|
Info(logger).Print("log", "test info")
|
|
|
|
Warn(logger).Print("log", "test warn")
|
|
|
|
Error(logger).Print("log", "test error")
|
|
|
|
}
|
2021-03-14 15:36:00 +08:00
|
|
|
|
|
|
|
func TestWrapper(t *testing.T) {
|
|
|
|
out := NewStdLogger(os.Stdout)
|
|
|
|
err := NewStdLogger(os.Stderr)
|
|
|
|
|
|
|
|
l := Wrap(out, err)
|
|
|
|
l.Print("message", "test")
|
|
|
|
}
|