Skip to content

Commit

Permalink
update log types
Browse files Browse the repository at this point in the history
  • Loading branch information
blampe committed Aug 9, 2024
1 parent 47c88a4 commit c659722
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions provider/pkg/await/watchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,18 @@ func NewEventAggregator(
m := checkerlog.WarningMessage(msg)
switch e.Type {
case corev1.EventTypeWarning:
logger.LogMessage(m)
logger.LogStatus(diag.Warning, m.S)
default:
m.Severity = diag.Debug
logger.LogMessage(m)
logger.LogStatus(diag.Debug, m.S)
}
return nil
},
)
}

type logMessager interface {
LogMessage(checkerlog.Message)
Log(diag.Severity, string)
LogStatus(diag.Severity, string)
}

func relatedEvents(owner *unstructured.Unstructured) func(*unstructured.Unstructured) bool {
Expand Down
9 changes: 6 additions & 3 deletions provider/pkg/await/watchers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"
"testing"

checkerlog "github.com/pulumi/cloud-ready-checks/pkg/checker/logging"
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/watch"
Expand Down Expand Up @@ -154,6 +154,9 @@ func TestRelatedEvent(t *testing.T) {

type log struct{ io.Writer }

func (l log) LogMessage(m checkerlog.Message) {
fmt.Fprintf(l, "%s %s", m.Severity, m.String())
func (l log) Log(sev diag.Severity, msg string) {
fmt.Fprintf(l, "%s %s", sev, msg)
}
func (l log) LogStatus(sev diag.Severity, msg string) {
l.Log(sev, msg)
}

0 comments on commit c659722

Please sign in to comment.