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

provider: Enable request/response logging #93

Merged
merged 1 commit into from
Feb 25, 2019
Merged

Conversation

radeksimko
Copy link
Contributor

This makes debugging for developers & users of this provider easier by exposing all requests & responses in the log (when >DEBUG severity is set).

Example:

---[ REQUEST ]---------------------------------------
GET /api/v4/user HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: go-gitlab
Accept: application/json
Private-Token: ACCTEST
Accept-Encoding: gzip


-----------------------------------------------------
2019/02/23 00:47:49 [DEBUG] GitLab API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Content-Length: 714
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json
Date: Sat, 23 Feb 2019 00:47:49 GMT
Etag: W/"2fb3928e98d70dbe9e8fe1b09573eab8"
Server: nginx
Strict-Transport-Security: max-age=31536000
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: bTiJWuX5Se5
X-Runtime: 0.137501

{"id":1,"name":"Administrator","username":"root","state":"active","avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon","web_url":"http://04e2294d82f2/root","created_at":"2019-02-23T00:46:48.473Z","bio":null,"location":null,"public_email":"","skype":"","linkedin":"","twitter":"","website_url":"","organization":null,"last_sign_in_at":null,"confirmed_at":"2019-02-23T00:46:48.381Z","last_activity_on":null,"email":"admin@example.com","theme_id":1,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":null,"is_admin":true}
-----------------------------------------------------

@ghost ghost added the size/XS label Feb 23, 2019
@roidelapluie
Copy link
Collaborator

I will merge this. However can we do something to redact security headers?

@radeksimko
Copy link
Contributor Author

@roidelapluie The debug log is only available to those who are capable of enabling the debug mode, which are in all (?) cases the same people who provide these (sensitive) credentials through configs or ENV variables in the first place.

We had some early discussions about scrubbing sensitive data internally and we might introduce a solution for that at some point in the future.

@roidelapluie roidelapluie merged commit a93c877 into master Feb 25, 2019
@roidelapluie
Copy link
Collaborator

Thanks!

@radeksimko radeksimko deleted the provider-logging branch February 26, 2019 06:26
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants