Skip to content

Commit

Permalink
fixup! Implement structured logging
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Apr 19, 2024
1 parent 95d2bf6 commit 5cf633b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 6 additions & 3 deletions linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,14 @@ func LinearRequest(ctx context.Context, payload *GraphQLRequest, into any) error
}
defer resp.Body.Close()
var respData GraphQLResponse
data, _ := io.ReadAll(resp.Body)
if resp.StatusCode != 200 {
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
} else if resp.StatusCode != 200 {
log.Error().Int("status_code", resp.StatusCode).Str("resp_data", string(data)).Msg("Got non-200 response")
} else {
log.Info().Str("resp_data", string(data)).Msg("Received GraphQL response from Linear")
}
log.Info().Str("data", string(data)).Msg("Received GraphQL response from Linear")
err = json.Unmarshal(data, &respData)
//err = json.NewDecoder(resp.Body).Decode(&respData)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions rageshake.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ api_server_url:

# A custom webhook URL that receives all the relevant data about the rageshake.
webhook_url: https://example.com/rageshake-webhook

# See https://github.com/tulir/zeroconfig for details.
logging:
min_level: debug
writers:
- type: stdout
format: json

0 comments on commit 5cf633b

Please sign in to comment.