diff --git a/lib/services/reconciler.go b/lib/services/reconciler.go index fb7ee569524b0..17b136a056152 100644 --- a/lib/services/reconciler.go +++ b/lib/services/reconciler.go @@ -23,7 +23,6 @@ import ( "log/slog" "github.com/gravitational/trace" - "github.com/sirupsen/logrus" "github.com/gravitational/teleport" "github.com/gravitational/teleport/api/types" @@ -54,9 +53,6 @@ type GenericReconcilerConfig[K comparable, T any] struct { OnUpdate func(ctx context.Context, new, old T) error // OnDelete is called when an existing resource is deleted. OnDelete func(context.Context, T) error - // Log is the reconciler's logger. - // TODO(tross) remove this when all components in e have been updated - Log logrus.FieldLogger // Logger emits log messages. Logger *slog.Logger } diff --git a/lib/srv/app/watcher.go b/lib/srv/app/watcher.go index c88e73dd7f5ab..706a17b2ea60f 100644 --- a/lib/srv/app/watcher.go +++ b/lib/srv/app/watcher.go @@ -21,7 +21,6 @@ package app import ( "context" "fmt" - "log/slog" "github.com/gravitational/trace" @@ -42,8 +41,7 @@ func (s *Server) startReconciler(ctx context.Context) error { OnCreate: s.onCreate, OnUpdate: s.onUpdate, OnDelete: s.onDelete, - // TODO(tross): update to use the server logger once it is converted to slog - Logger: slog.With("kind", types.KindApp), + Logger: s.log.With("kind", types.KindApp), }) if err != nil { return trace.Wrap(err) @@ -77,9 +75,8 @@ func (s *Server) startResourceWatcher(ctx context.Context) (*services.GenericWat watcher, err := services.NewAppWatcher(ctx, services.AppWatcherConfig{ ResourceWatcherConfig: services.ResourceWatcherConfig{ Component: teleport.ComponentApp, - // TODO(tross): update this once converted to use slog - // Log: s.log, - Client: s.c.AccessPoint, + Logger: s.log, + Client: s.c.AccessPoint, }, AppGetter: s.c.AccessPoint, }) diff --git a/lib/srv/desktop/discovery.go b/lib/srv/desktop/discovery.go index 0e22d2487a802..93a46deeb2025 100644 --- a/lib/srv/desktop/discovery.go +++ b/lib/srv/desktop/discovery.go @@ -23,7 +23,6 @@ import ( "encoding/hex" "errors" "fmt" - "log/slog" "maps" "net" "net/netip" @@ -55,8 +54,7 @@ func (s *WindowsService) startDesktopDiscovery() error { OnCreate: s.upsertDesktop, OnUpdate: s.updateDesktop, OnDelete: s.deleteDesktop, - // TODO(tross): update to use the service logger once it is converted to use slog - Logger: slog.With("kind", types.KindWindowsDesktop), + Logger: s.cfg.Logger.With("kind", types.KindWindowsDesktop), }) if err != nil { return trace.Wrap(err) diff --git a/lib/usagereporter/teleport/aggregating/reporter.go b/lib/usagereporter/teleport/aggregating/reporter.go index 66d723f6fba78..2813581976afd 100644 --- a/lib/usagereporter/teleport/aggregating/reporter.go +++ b/lib/usagereporter/teleport/aggregating/reporter.go @@ -28,7 +28,6 @@ import ( "github.com/google/uuid" "github.com/gravitational/trace" "github.com/jonboulle/clockwork" - "github.com/sirupsen/logrus" "github.com/gravitational/teleport/api/types" prehogv1 "github.com/gravitational/teleport/gen/proto/go/prehog/v1" @@ -52,15 +51,11 @@ const ( type ReporterConfig struct { // Backend is the backend used to store reports. Required Backend backend.Backend - // Log is the logger used for logging. - // TODO(tross): Delete once e has been converted - Log logrus.FieldLogger // Logger is the used for emitting log messages. Logger *slog.Logger // Clock is the clock used for timestamping reports and deciding when to // persist them to the backend. Optional, defaults to the real clock. Clock clockwork.Clock - // ClusterName is the ClusterName resource for the current cluster, used for // anonymization and to report the cluster name itself. Required. ClusterName types.ClusterName diff --git a/lib/usagereporter/teleport/aggregating/submitter.go b/lib/usagereporter/teleport/aggregating/submitter.go index 528966336260b..e36dca61e32ff 100644 --- a/lib/usagereporter/teleport/aggregating/submitter.go +++ b/lib/usagereporter/teleport/aggregating/submitter.go @@ -26,7 +26,6 @@ import ( "github.com/google/uuid" "github.com/gravitational/trace" - "github.com/sirupsen/logrus" "github.com/gravitational/teleport/api/types" "github.com/gravitational/teleport/api/utils/retryutils" @@ -69,9 +68,6 @@ var alertMessage = fmt.Sprintf("Teleport has failed to contact the usage reporti type SubmitterConfig struct { // Backend is the backend to use to read reports and apply locks. Required. Backend backend.Backend - // Log is the [logrus.FieldLogger] used for logging. - // TODO(tross): remove once e has been converted - Log logrus.FieldLogger // Logger is the used for emitting log messages. Logger *slog.Logger // Status is used to create or clear cluster alerts on a failure. Required. diff --git a/lib/usagereporter/teleport/usagereporter.go b/lib/usagereporter/teleport/usagereporter.go index 928b37a0dbe8a..91b2845611b9c 100644 --- a/lib/usagereporter/teleport/usagereporter.go +++ b/lib/usagereporter/teleport/usagereporter.go @@ -122,16 +122,7 @@ func (t *StreamingUsageReporter) Run(ctx context.Context) { type SubmitFunc = usagereporter.SubmitFunc[prehogv1a.SubmitEventRequest] -// TODO(tross): change the log type once e has been updated -func NewStreamingUsageReporter(log any, clusterName types.ClusterName, anonymizationKey string, submitter SubmitFunc) (*StreamingUsageReporter, error) { - logger := slog.Default() - - if log != nil { - if l, ok := log.(*slog.Logger); ok { - logger = l - } - } - +func NewStreamingUsageReporter(logger *slog.Logger, clusterName types.ClusterName, anonymizationKey string, submitter SubmitFunc) (*StreamingUsageReporter, error) { if anonymizationKey == "" { return nil, trace.BadParameter("anonymization key is required") }