Skip to content

Commit 28aa9d4

Browse files
committed
feat: api call & attempt console output updated
1 parent 081f17c commit 28aa9d4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cmd/main.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,20 @@ func writeToConsole(ch <-chan domain.UdpPayload) {
5757
if err := apiCall.Validate(); err == nil {
5858
//fmt.Println("Error sending WebSocket message:", err)
5959
}
60-
fmt.Printf("Client:%s ---%dms---> AWS:%s:%s\n", apiCall.ClientId, apiCall.Latency, apiCall.Service, apiCall.Api)
60+
t := time.Unix(apiCall.Timestamp/1000, 0).UTC()
61+
humanReadable := t.Format("2006-01-02 15:04:05 UTC")
62+
fmt.Printf("%s [ Client:%s(%s) ==========> AWS:%s:%s ] : %dms %s Code:%d\n",
63+
humanReadable, apiCall.ClientId, apiCall.UserAgent[:25], apiCall.Service, apiCall.Api, apiCall.Latency, apiCall.Region, apiCall.FinalHttpStatusCode)
6164
}
6265

6366
case "ApiCallAttempt":
6467
if apiCallAttempt, err := domain.NewApiCallAttempt(msg); err == nil {
6568
if err := apiCallAttempt.Validate(); err == nil {
66-
// Convert timestamp to Time
6769
t := time.Unix(apiCallAttempt.Timestamp/1000, 0).UTC()
68-
69-
// Format the Time to a human-readable string
7070
humanReadable := t.Format("2006-01-02 15:04:05 UTC")
71-
fmt.Printf("%s [ Client:%s ==========> AWS:%s:%s(%s) ] : %dms Region:%s\n",
72-
humanReadable, apiCallAttempt.ClientId, apiCallAttempt.Service, apiCallAttempt.Api, apiCallAttempt.Fqdn, apiCallAttempt.AttemptLatency, apiCallAttempt.Region)
71+
fmt.Printf("%s [ Client:%s(%s) ==========> AWS:%s:%s(%s) ] : %dms %s Code:%d\n",
72+
humanReadable, apiCallAttempt.ClientId, apiCallAttempt.UserAgent[:25], apiCallAttempt.Service, apiCallAttempt.Api, apiCallAttempt.Fqdn, apiCallAttempt.AttemptLatency, apiCallAttempt.Region, apiCallAttempt.HttpStatusCode)
7373
}
74-
print(apiCallAttempt)
7574
}
7675
}
7776
}

0 commit comments

Comments
 (0)