mcp: fix stray log.Printf in notifySessions
I encountered these logs, and they were distracting and noisy. We shouldn't log to stderr unless configured by the user. Thread through the logger. Also, use ensureLogger in the streamable client to simplify call sites. Updates #708 Updates #684
This commit is contained in:
parent
b012d0824e
commit
6f6e196c27
1 changed files with 13 additions and 14 deletions
|
|
@ -508,7 +508,7 @@ func (s *Server) changeAndNotify(notification string, params Params, change func
|
|||
sessions = slices.Clone(s.sessions)
|
||||
}
|
||||
s.mu.Unlock()
|
||||
notifySessions(sessions, notification, params)
|
||||
notifySessions(sessions, notification, params, s.opts.Logger)
|
||||
}
|
||||
|
||||
// Sessions returns an iterator that yields the current set of server sessions.
|
||||
|
|
@ -708,7 +708,7 @@ func (s *Server) ResourceUpdated(ctx context.Context, params *ResourceUpdatedNot
|
|||
subscribedSessions := s.resourceSubscriptions[params.URI]
|
||||
sessions := slices.Collect(maps.Keys(subscribedSessions))
|
||||
s.mu.Unlock()
|
||||
notifySessions(sessions, notificationResourceUpdated, params)
|
||||
notifySessions(sessions, notificationResourceUpdated, params, s.opts.Logger)
|
||||
s.opts.Logger.Info("resource updated notification sent", "uri", params.URI, "subscriber_count", len(sessions))
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue