Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: add logging of request from proxy stub for debugging purposes. #13

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

ashashev
Copy link
Contributor

It's pretty hard to understand what request will be executed from mockingbird to a remote server, when stub works in proxy mode. The logging of requests simplifies understanding what happens. It's not necessary, but could be useful.

The PR add to the log the following records:

{"@timestamp":"2023-09-30T20:11:48.776Z","loggerName":"ru.tinkoff.tcb.mockingbird.api.PublicApiHandler","threadName":"ZScheduler-2","level":"DEBUG","message":"Executing request: curl \\\n  --request GET \\\n  --url 'https://catfact.ninja/fact' \\\n  --header 'Host: catfact.ninja' \\\n  --header 'User-Agent: curl/7.88.1' \\\n  --header 'Accept: */*' \\\n  --location \\\n  --max-redirs 32","correlationId":"ee779037-c036-465b-9ac8-46987bb3a7be","payload":{"path":"/alpha/fact","method":"GET","name":"cats fact"}}

@danslapman
Copy link
Member

I think we should have a flag in settings for this (disabled by default)

@ashashev ashashev force-pushed the chore/log-proxy-request branch from 760301c to 65d3bde Compare September 30, 2023 21:12
@ashashev
Copy link
Contributor Author

Add parameter to the config. Also, I forgot to add logging to stubs that expect response as JSON or XML. I added logging to it too.

@ashashev ashashev force-pushed the chore/log-proxy-request branch from 65d3bde to cb6a9eb Compare October 10, 2023 22:22
@ashashev ashashev force-pushed the chore/log-proxy-request branch from cb6a9eb to 4e6ff5b Compare October 11, 2023 21:26
@danslapman danslapman merged commit 511c7dc into leviysoft:main Oct 11, 2023
@ashashev ashashev deleted the chore/log-proxy-request branch November 4, 2023 18:43
Sign up for free to 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.

2 participants