Files
query-orchestration/internal/serviceconfig/logger/testlogger_test.go
T
Michael McGuinness 7001ca854c Merged in feature/docinitialisation (pull request #41)
Queuing Changes and Cfg Testing

* staarting

* staarting

* startedpush

* note

* save

* mocking

* removederrs

* fixtests

* cleanuperrs

* newenvsetup

* preppingtests

* queue

* mmovetocfgpassunittests

* sortoutconfig

* passinginteg

* deps

* fixtests
2025-02-03 17:30:50 +00:00

26 lines
600 B
Go

package logger
import (
"log/slog"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTestLogger(t *testing.T) {
tl := &TestLogger{T: t}
logger := slog.New(tl)
slog.SetDefault(logger)
slog.Info("test message", "field", "value")
slog.Info("test message", "field", "second")
slog.Warn("test message", "field", "warn")
slog.Error("test message", "field", "error")
assert.Len(t, tl.Logs, 4)
assert.Equal(t, "value", tl.Logs[0]["field"])
assert.Equal(t, "second", tl.Logs[1]["field"])
assert.Equal(t, "warn", tl.Logs[2]["field"])
assert.Equal(t, "error", tl.Logs[3]["field"])
}