Skip to content

Commit

Permalink
Pretty print Broker ResponseMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
mzampetakis committed Mar 20, 2024
1 parent 30dfc33 commit 8ffd90a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ type ResponseMessage struct {
ResultDetails []WorkflowDetails `json:"-"`
}

func (rm *ResponseMessage) String() string {
return fmt.Sprintf("ResponseMessage{Response:%+v, RunID:%+v, Result:%+v, ResultDetails:%+v}", rm.Response,
*rm.RunID, rm.Result, rm.ResultDetails)
}

type WorkflowDetails struct {
WorkflowID string `json:"workflow_id"`
WorkflowName string `json:"workflow_name"`
Expand Down
5 changes: 2 additions & 3 deletions cmd/github-actions-adapter/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package serve

import (
"context"
"fmt"
"log/slog"
"radicle-github-actions-adapter/app"
"radicle-github-actions-adapter/app/broker"
Expand Down Expand Up @@ -62,7 +61,7 @@ func (gas *GitHubActionsServer) Serve(ctx context.Context) error {
ID: eventUUID,
},
}
gas.App.Logger.Debug("sending message", "message", fmt.Sprintf("%+v", jobResponse))
gas.App.Logger.Debug("sending message", "message", jobResponse)
err = gas.Broker.ServeResponse(ctx, jobResponse)
if err != nil {
gas.App.Logger.Error("could not send response message to broker", "error", err.Error())
Expand Down Expand Up @@ -109,7 +108,7 @@ func (gas *GitHubActionsServer) Serve(ctx context.Context) error {
_ = gas.commentOnPatch(ctx, brokerRequestMessage, commentMessage)
}
}
gas.App.Logger.Debug("sending message", "message", fmt.Sprintf("%+v", resultResponse))
gas.App.Logger.Debug("sending message", "message", resultResponse)
err = gas.Broker.ServeResponse(ctx, resultResponse)
if err != nil {
gas.App.Logger.Error("could not send response message to broker", "error", err.Error())
Expand Down

0 comments on commit 8ffd90a

Please sign in to comment.