mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
27 lines
488 B
Go
27 lines
488 B
Go
package logx_test
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/charlienet/go-mixed/logx"
|
|
)
|
|
|
|
func TestNewLogrus(t *testing.T) {
|
|
_ = logx.WithOutput(logx.LogrusOutputOptions{
|
|
Output: logx.Console,
|
|
})
|
|
}
|
|
|
|
func TestFileOutput(t *testing.T) {
|
|
t.Log(os.Getwd())
|
|
logger := logx.NewLogrus(
|
|
// logx.WithFormatter(&logrus.TextFormatter{}),
|
|
logx.WithOptions(logx.LogrusOptions{ShowCaller: true}),
|
|
logx.WithOutput(logx.LogrusOutputOptions{
|
|
FileName: "abc.log",
|
|
}))
|
|
|
|
logger.Info("abc")
|
|
}
|