Fix multiline function call style violations
Expand mixed inline/multiline function calls so each argument is on its own line, matching the one-argument-per-line rule. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -26,13 +26,17 @@ import (
|
||||
func LoggingMiddleware(logger *log.Logger) func(mcp.MethodHandler) mcp.MethodHandler {
|
||||
return func(next mcp.MethodHandler) mcp.MethodHandler {
|
||||
return func(ctx context.Context, method string, req mcp.Request) (mcp.Result, error) {
|
||||
logger.InfoCtx(ctx, fmt.Sprintf("mcp %q method started", method),
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
fmt.Sprintf("mcp %q method started", method),
|
||||
log.String("method", method),
|
||||
log.Bool("has_params", req.GetParams() != nil),
|
||||
)
|
||||
|
||||
if ctr, ok := req.(*mcp.CallToolRequest); ok {
|
||||
logger.InfoCtx(ctx, fmt.Sprintf("calling %q tool", ctr.Params.Name),
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
fmt.Sprintf("calling %q tool", ctr.Params.Name),
|
||||
log.String("tool_name", ctr.Params.Name),
|
||||
)
|
||||
}
|
||||
@@ -42,21 +46,27 @@ func LoggingMiddleware(logger *log.Logger) func(mcp.MethodHandler) mcp.MethodHan
|
||||
duration := time.Since(start)
|
||||
|
||||
if err != nil {
|
||||
logger.ErrorCtx(ctx, fmt.Sprintf("mcp %q method failed", method),
|
||||
logger.ErrorCtx(
|
||||
ctx,
|
||||
fmt.Sprintf("mcp %q method failed", method),
|
||||
log.String("method", method),
|
||||
log.Int64("duration_ms", duration.Milliseconds()),
|
||||
log.Error(err),
|
||||
)
|
||||
} else {
|
||||
|
||||
logger.InfoCtx(ctx, fmt.Sprintf("mcp %q method completed", method),
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
fmt.Sprintf("mcp %q method completed", method),
|
||||
log.String("method", method),
|
||||
log.Int64("duration_ms", duration.Milliseconds()),
|
||||
log.Bool("has_result", result != nil),
|
||||
)
|
||||
|
||||
if ctr, ok := result.(*mcp.CallToolResult); ok {
|
||||
logger.InfoCtx(ctx, "tool call result",
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
"tool call result",
|
||||
log.Bool("is_error", ctr.IsError),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ func convertPanicToError(ctx context.Context, logger *log.Logger, panicValue any
|
||||
}
|
||||
|
||||
// Log unexpected panics with stack trace
|
||||
logger.ErrorCtx(ctx, "unexpected panic in MCP method handler",
|
||||
logger.ErrorCtx(
|
||||
ctx,
|
||||
"unexpected panic in MCP method handler",
|
||||
log.Any("panic", panicValue),
|
||||
log.String("stack", string(debug.Stack())),
|
||||
)
|
||||
|
||||
@@ -21,10 +21,15 @@ import (
|
||||
)
|
||||
|
||||
func allApproversCursor() *page.Cursor[coredata.MembershipProfileOrderField] {
|
||||
return page.NewCursor(100, nil, page.Head, page.OrderBy[coredata.MembershipProfileOrderField]{
|
||||
Field: coredata.MembershipProfileOrderFieldCreatedAt,
|
||||
Direction: page.OrderDirectionDesc,
|
||||
})
|
||||
return page.NewCursor(
|
||||
100,
|
||||
nil,
|
||||
page.Head,
|
||||
page.OrderBy[coredata.MembershipProfileOrderField]{
|
||||
Field: coredata.MembershipProfileOrderFieldCreatedAt,
|
||||
Direction: page.OrderDirectionDesc,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func profileIDs(p *page.Page[*coredata.MembershipProfile, coredata.MembershipProfileOrderField]) []gid.GID {
|
||||
|
||||
@@ -35,7 +35,9 @@ func RequireAPIKeyHandler(
|
||||
correlationID = r.Header.Get("X-Correlation-ID")
|
||||
}
|
||||
|
||||
logger.InfoCtx(ctx, "MCP authentication attempt",
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
"MCP authentication attempt",
|
||||
log.String("correlation_id", correlationID),
|
||||
log.String("path", r.URL.Path),
|
||||
)
|
||||
@@ -48,7 +50,9 @@ func RequireAPIKeyHandler(
|
||||
return
|
||||
}
|
||||
|
||||
logger.InfoCtx(ctx, "MCP authentication successful",
|
||||
logger.InfoCtx(
|
||||
ctx,
|
||||
"MCP authentication successful",
|
||||
log.String("correlation_id", correlationID),
|
||||
log.String("identity_id", identity.ID.String()),
|
||||
log.String("api_key_id", apiKey.ID.String()),
|
||||
|
||||
@@ -283,9 +283,13 @@ func (r *mutationResolver) UpdateFullName(ctx context.Context, input types.Updat
|
||||
return nil, gqlutils.Unauthenticatedf(ctx, "authentication is required to request access")
|
||||
}
|
||||
|
||||
identity, err := r.iam.AccountService.UpdateIdentity(ctx, identity.ID, &iam.UpdateIdentityRequest{
|
||||
FullName: input.FullName,
|
||||
})
|
||||
identity, err := r.iam.AccountService.UpdateIdentity(
|
||||
ctx,
|
||||
identity.ID,
|
||||
&iam.UpdateIdentityRequest{
|
||||
FullName: input.FullName,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
r.logger.ErrorCtx(ctx, "cannot update identity", log.Error(err))
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
|
||||
Reference in New Issue
Block a user