mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
## What changed?
Integrate Go 1.26's new `go fix` into workflow.
NOTE that the changes caused our linter to fire; a [separate
commit](1b23f787ae)
addresses those.
## Why?
Ensure Go code is standardized/modernized.
## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
42 lines
859 B
Go
42 lines
859 B
Go
package temporaltest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.temporal.io/sdk/log"
|
|
)
|
|
|
|
var _ log.Logger = &testLogger{}
|
|
|
|
// testLogger implements a Go SDK logger by writing to the test output.
|
|
//
|
|
// Text will be printed only if the test fails or the -test.v flag is set.
|
|
type testLogger struct {
|
|
t *testing.T
|
|
}
|
|
|
|
func (tl *testLogger) logLevel(lvl, msg string, keyvals ...any) {
|
|
if tl.t == nil {
|
|
return
|
|
}
|
|
args := []any{lvl, msg}
|
|
args = append(args, keyvals...)
|
|
tl.t.Log(args...)
|
|
}
|
|
|
|
func (tl *testLogger) Debug(msg string, keyvals ...any) {
|
|
tl.logLevel("DEBUG", msg, keyvals)
|
|
}
|
|
|
|
func (tl *testLogger) Info(msg string, keyvals ...any) {
|
|
tl.logLevel("INFO ", msg, keyvals)
|
|
}
|
|
|
|
func (tl *testLogger) Warn(msg string, keyvals ...any) {
|
|
tl.logLevel("WARN ", msg, keyvals)
|
|
}
|
|
|
|
func (tl *testLogger) Error(msg string, keyvals ...any) {
|
|
tl.logLevel("ERROR", msg, keyvals)
|
|
}
|