Migrate official MCP SDK logging from Logrus to slog - #505
Conversation
| "tool", params.Name, "arguments", string(params.Arguments)) | ||
| toolName := "unknown" | ||
| arguments := "" | ||
| if params, ok := req.GetParams().(*mcp.CallToolParamsRaw); ok { |
There was a problem hiding this comment.
I see the defensive check on logger != nil was removed here. Do we not need it anymore?
There was a problem hiding this comment.
Thanks for catching that! I missed preserving the nil guard while expanding the logging logic. I’ll restore it so the middleware continues without logging if the logger is nil.
| Version string `json:"version"` | ||
| } | ||
|
|
||
| const officialSlogOutputPath = "terraform-mcp-official.log" |
There was a problem hiding this comment.
Should this const be renamed to officialSlogOutputFileName instead of Path? I'm just wondering where it tries to look for this file in initSlog. Is it in the cwd?
There was a problem hiding this comment.
Agreed the new name would be clearer. It’s a relative filename, so the log is created in the cwd. If the server restarts from the same directory, it appends to the existing file. I’ll rename it accordingly.
a1fa929 to
40157a6
Compare
This PR:
What hasn’t changed:
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.