mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00: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](https://github.com/temporalio/temporal/pull/9337/commits/1b23f787aef370098b35829c4d17dcc06230b4c1) 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)
|
|
}
|