Skip to content

Add request query parameters to Complement request debug logs - #250

Merged
kegsay merged 1 commit into
masterfrom
madlittlemods/add-query-params-to-request-log-output
Dec 17, 2021
Merged

Add request query parameters to Complement request debug logs#250
kegsay merged 1 commit into
masterfrom
madlittlemods/add-query-params-to-request-log-output

Conversation

@MadLittleMods

@MadLittleModsMadLittleMods commented Dec 2, 2021

Copy link
Copy Markdown
Contributor

Add request query parameters to Complement request debug logs (COMPLEMENT_DEBUG=1), https://github.com/matrix-org/complement/blob/master/ONBOARDING.md#i-think-complement-is-doing-something-weird-can-i-get-more-logs

Before:

msc2716_test.go:899: Making POST request to http://localhost:57176/_matrix/client/unstable/org.matrix.msc2716/rooms/%21WfOaOcxJTCHBxspVgq:hs1/batch_send
msc2716_test.go:899: Request body: {"events":[{"content":{"body":"Historical 0 (batch=0)","msgtype":"m.text","org.matrix.msc2716.historical":true},"origin_server_ts":1638404618714,"sender":"@maria:hs1","type":"m.room.message"}],"state_events_at_start":[{"content":{"displayname":"some-display-name-for-@maria:hs1","membership":"join"},"origin_server_ts":1638404618714,"sender":"@maria:hs1","state_key":"@maria:hs1","type":"m.room.member"}]}

After:

msc2716_test.go:899: Making POST request to http://localhost:57160/_matrix/client/unstable/org.matrix.msc2716/rooms/%21KblUOBFIMMmAVoZnpQ:hs1/batch_send?prev_event_id=%241GidKbmhon-1habkcZokuhcjjvcLLQ5xq2FoVHrdk1E
msc2716_test.go:899: Request body: {"events":[{"content":{"body":"Historical 0 (batch=0)","msgtype":"m.text","org.matrix.msc2716.historical":true},"origin_server_ts":1638404572878,"sender":"@maria:hs1","type":"m.room.message"}],"state_events_at_start":[{"content":{"displayname":"some-display-name-for-@maria:hs1","membership":"join"},"origin_server_ts":1638404572878,"sender":"@maria:hs1","state_key":"@maria:hs1","type":"m.room.member"}]}

Split out from #214

When using `COMPLEMENT_DEBUG=1`, here is the terminal output:
Before:
```
msc2716_test.go:899: Making POST request to http://localhost:57176/_matrix/client/unstable/org.matrix.msc2716/rooms/%21WfOaOcxJTCHBxspVgq:hs1/batch_send
msc2716_test.go:899: Request body: {"events":[{"content":{"body":"Historical 0 (batch=0)","msgtype":"m.text","org.matrix.msc2716.historical":true},"origin_server_ts":1638404618714,"sender":"@maria:hs1","type":"m.room.message"}],"state_events_at_start":[{"content":{"displayname":"some-display-name-for-@maria:hs1","membership":"join"},"origin_server_ts":1638404618714,"sender":"@maria:hs1","state_key":"@maria:hs1","type":"m.room.member"}]}
```
After:
```
msc2716_test.go:899: Making POST request to http://localhost:57160/_matrix/client/unstable/org.matrix.msc2716/rooms/%21KblUOBFIMMmAVoZnpQ:hs1/batch_send?prev_event_id=%241GidKbmhon-1habkcZokuhcjjvcLLQ5xq2FoVHrdk1E
msc2716_test.go:899: Request body: {"events":[{"content":{"body":"Historical 0 (batch=0)","msgtype":"m.text","org.matrix.msc2716.historical":true},"origin_server_ts":1638404572878,"sender":"@maria:hs1","type":"m.room.message"}],"state_events_at_start":[{"content":{"displayname":"some-display-name-for-@maria:hs1","membership":"join"},"origin_server_ts":1638404572878,"sender":"@maria:hs1","state_key":"@maria:hs1","type":"m.room.member"}]}
```
@clokep

Copy link
Copy Markdown
Member

Is the difference just the ?prev_event_id=%241GidKbmhon-1habkcZokuhcjjvcLLQ5xq2FoVHrdk1E on the first line? Or does the second line also differ?

if c.Debug {
t.Logf("Making %s request to %s", method, reqURL)
t.Logf("Making %s request to %s", method, req.URL)
contentType := req.Header.Get("Content-Type")

@MadLittleModsMadLittleModsDec 2, 2021

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the difference just the ?prev_event_id=%241GidKbmhon-1habkcZokuhcjjvcLLQ5xq2FoVHrdk1E on the first line? Or does the second line also differ?

Just the first line

@kegsay
kegsay merged commit 73763b8 into masterDec 17, 2021
@MadLittleMods

Copy link
Copy Markdown
ContributorAuthor

Thanks @kegsay 🐤

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@MadLittleMods@clokep@kegsay