Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use locally scoped slog loggers instead of default #50950

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/reversetunnel/srv.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ func NewServer(cfg Config) (reversetunnelclient.Server, error) {
ResourceWatcherConfig: services.ResourceWatcherConfig{
Component: cfg.Component,
Client: cfg.LocalAccessPoint,
// TODO(tross): update this after converting to slog here
// Logger: cfg.Log,
Logger: cfg.Logger,
},
ProxiesC: make(chan []types.Server, 10),
ProxyGetter: cfg.LocalAccessPoint,
Expand Down Expand Up @@ -1211,10 +1210,9 @@ func newRemoteSite(srv *server, domainName string, sconn ssh.Conn) (*remoteSite,
remoteSite.remoteAccessPoint = accessPoint
nodeWatcher, err := services.NewNodeWatcher(closeContext, services.NodeWatcherConfig{
ResourceWatcherConfig: services.ResourceWatcherConfig{
Component: srv.Component,
Client: accessPoint,
// TODO(tross) update this after converting to use slog
// Logger: srv.Log,
Component: srv.Component,
Client: accessPoint,
Logger: srv.Logger,
MaxStaleness: time.Minute,
},
NodesGetter: accessPoint,
Expand Down Expand Up @@ -1247,10 +1245,9 @@ func newRemoteSite(srv *server, domainName string, sconn ssh.Conn) (*remoteSite,
remoteWatcher, err := services.NewCertAuthorityWatcher(srv.ctx, services.CertAuthorityWatcherConfig{
ResourceWatcherConfig: services.ResourceWatcherConfig{
Component: teleport.ComponentProxy,
// TODO(tross): update this after converting to slog
// Logger: srv.log,
Clock: srv.Clock,
Client: remoteSite.remoteAccessPoint,
Logger: srv.logger,
Clock: srv.Clock,
Client: remoteSite.remoteAccessPoint,
},
Types: []types.CertAuthType{types.HostCA},
})
Expand Down
4 changes: 1 addition & 3 deletions lib/srv/discovery/database_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package discovery

import (
"context"
"log/slog"
"sync"

"github.com/gravitational/trace"
Expand Down Expand Up @@ -54,8 +53,7 @@ func (s *Server) startDatabaseWatchers() error {
defer mu.Unlock()
return utils.FromSlice(newDatabases, types.Database.GetName)
},
// TODO(tross): update to use the server logger once it is converted to use slog
Logger: slog.With("kind", types.KindDatabase),
Logger: s.Log.With("kind", types.KindDatabase),
OnCreate: s.onDatabaseCreate,
OnUpdate: s.onDatabaseUpdate,
OnDelete: s.onDatabaseDelete,
Expand Down
5 changes: 2 additions & 3 deletions lib/srv/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -1869,9 +1869,8 @@ func (s *Server) getAzureSubscriptions(ctx context.Context, subs []string) ([]st
func (s *Server) initTeleportNodeWatcher() (err error) {
s.nodeWatcher, err = services.NewNodeWatcher(s.ctx, services.NodeWatcherConfig{
ResourceWatcherConfig: services.ResourceWatcherConfig{
Component: teleport.ComponentDiscovery,
// TODO(tross): update this after converting logging to use slog
// Logger: s.Logger,
Component: teleport.ComponentDiscovery,
Logger: s.Log,
Client: s.AccessPoint,
MaxStaleness: time.Minute,
},
Expand Down
4 changes: 1 addition & 3 deletions lib/srv/discovery/kube_services_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package discovery

import (
"context"
"log/slog"
"sync"
"time"

Expand Down Expand Up @@ -62,8 +61,7 @@ func (s *Server) startKubeAppsWatchers() error {
defer mu.Unlock()
return utils.FromSlice(appResources, types.Application.GetName)
},
// TODO(tross): update to use the server logger once it is converted to use slog
Logger: slog.With("kind", types.KindApp),
Logger: s.Log.With("kind", types.KindApp),
OnCreate: s.onAppCreate,
OnUpdate: s.onAppUpdate,
OnDelete: s.onAppDelete,
Expand Down
Loading