2023-11-09 06:35:59 +00:00
|
|
|
package logutils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2024-11-04 08:09:28 +00:00
|
|
|
"go.uber.org/zap/zapcore"
|
2023-11-09 06:35:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPrintOrigins(t *testing.T) {
|
2024-11-04 08:09:28 +00:00
|
|
|
buffer := bytes.NewBuffer(nil)
|
|
|
|
|
|
|
|
logger := defaultLogger()
|
|
|
|
logger.Core().(*Core).UpdateSyncer(zapcore.AddSync(buffer))
|
|
|
|
|
|
|
|
logger.Info("hello")
|
|
|
|
|
|
|
|
require.Contains(t, buffer.String(), "logutils/logger_test.go:17")
|
2023-11-09 06:35:59 +00:00
|
|
|
}
|