Skip to content

Commit

Permalink
Http logging utils
Browse files Browse the repository at this point in the history
  • Loading branch information
SodaDev committed Dec 20, 2021
1 parent b697660 commit 76c08c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions log/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ func (hi headerItem) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
}

func ReportAPIRequest(request events.APIGatewayProxyRequest) {
DebugW("Got request", buildRequestLogTrackingFields(request)...)
DebugW("Got request", BuildRequestLogTrackingFields(request)...)
}

func buildRequestLogTrackingFields(request events.APIGatewayProxyRequest) []interface{} {
func ReportAPIRequestFailure(request events.APIGatewayProxyRequest) {
WarnW("Got request", BuildRequestLogTrackingFields(request)...)
}

func BuildRequestLogTrackingFields(request events.APIGatewayProxyRequest) []interface{} {
return []interface{}{
zap.String("Body.context.origin.request.method", request.HTTPMethod),
zap.String("Body.context.origin.request.url", request.Path),
Expand Down

0 comments on commit 76c08c5

Please sign in to comment.