github.com/kubeshop/testkube@v1.17.23/pkg/logs/adapter/debug.go (about) 1 package adapter 2 3 import ( 4 "context" 5 6 "go.uber.org/zap" 7 8 "github.com/kubeshop/testkube/pkg/log" 9 "github.com/kubeshop/testkube/pkg/logs/events" 10 ) 11 12 var _ Adapter = &DebugAdapter{} 13 14 // NewDebugAdapter creates new DebugAdapter which will write logs to stdout 15 func NewDebugAdapter() *DebugAdapter { 16 return &DebugAdapter{ 17 l: log.DefaultLogger, 18 } 19 } 20 21 type DebugAdapter struct { 22 l *zap.SugaredLogger 23 } 24 25 func (s *DebugAdapter) Init(ctx context.Context, id string) error { 26 s.l.Debugw("Initializing", "id", id) 27 return nil 28 } 29 30 func (s *DebugAdapter) Notify(ctx context.Context, id string, e events.Log) error { 31 s.l.Debugw("got event", "id", id, "event", e) 32 return nil 33 } 34 35 func (s *DebugAdapter) Stop(ctx context.Context, id string) error { 36 s.l.Debugw("Stopping", "id", id) 37 return nil 38 } 39 40 func (s *DebugAdapter) Name() string { 41 return "dummy" 42 }