Skip to content

feat: deprecated logger in client & add Logger in ClientOption#738

Merged
findleyr merged 3 commits intomodelcontextprotocol:mainfrom
CocaineCong:feature-client-logger
Jan 5, 2026
Merged

feat: deprecated logger in client & add Logger in ClientOption#738
findleyr merged 3 commits intomodelcontextprotocol:mainfrom
CocaineCong:feature-client-logger

Conversation

@CocaineCong
Copy link
Copy Markdown
Contributor

Fix #708

  1. deprecated logger in client
  2. add Logger in ClientOption
  3. add unit test for Logger

Copy link
Copy Markdown
Contributor

@findleyr findleyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM following one minor nit.

Comment thread mcp/client.go
@CocaineCong
Copy link
Copy Markdown
Contributor Author

LGTM following one minor nit.

I've already corrected it. PTAL.

Comment thread mcp/client.go
@findleyr findleyr merged commit 61be548 into modelcontextprotocol:main Jan 5, 2026
5 checks passed
Comment thread mcp/client.go
if options != nil {
opts = *options
}
options = nil // prevent reuse
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this prevent reuse?
As far as I can tell, it does so only for the current function, which is short.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cause i see the func NewServer (which in mcp/server.go) do this, i thought this is the code style of this program.😂
image

If you think it's unnecessary, I will remove it.

Comment thread mcp/client.go
//
// If non-nil, the provided options configure the Client.
func NewClient(impl *Implementation, opts *ClientOptions) *Client {
func NewClient(impl *Implementation, options *ClientOptions) *Client {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename to options? The caller knows the type, which already says Options?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar above, I just keep the code style consistent.

image

If you think this will cause confusion, I will rename back.

Comment thread mcp/client.go
jba pushed a commit that referenced this pull request Jan 5, 2026
Fix #708   
Link PR #738

deleted the old logger in client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: add ClientOptions.Logger

3 participants