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

New log level: trace #363

Closed
igungor opened this issue Sep 23, 2021 · 0 comments · Fixed by #430
Closed

New log level: trace #363

igungor opened this issue Sep 23, 2021 · 0 comments · Fixed by #430

Comments

@igungor
Copy link
Member

igungor commented Sep 23, 2021

I think we should have a new log level which enables SDK verbose logging. When I debug an issue, I enable SDK verbose logging to see the request/response cycles between s5cmd and the remote endpoint.

Currently we have debug, info and error. --log=debug is used when the cp command skips overriding a file when certain criteria is met, such as cp -n -s -u.

I propose a new level because we can't use debug to print SDK verbose logs, which is not structured. That'd break our --json output.

--log=trace will be used to see what's really happening under the hood. It'll look like this:

$ s5cmd --log=trace ls

2021/09/23 10:43:47 DEBUG: Request s3/ListBuckets Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET / HTTP/1.1
Host: s3.amazonaws.com
User-Agent: aws-sdk-go/1.35.13 (go1.16.2; darwin; amd64)
Authorization: <REDACTED>
X-Amz-Content-Sha256: <REDACTED>
X-Amz-Date: 20210923T074347Z
X-Amz-Security-Token: <REDACTED>
Accept-Encoding: gzip


-----------------------------------------------------
2021/09/23 10:43:48 DEBUG: Response s3/ListBuckets Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Thu, 23 Sep 2021 07:43:48 GMT
Server: AmazonS3
X-Amz-Id-2: <REDACTED>
X-Amz-Request-Id: <REDACTED>


-----------------------------------------------------
ERROR "ls": ExpiredToken: The provided token has expired. status code: 400, request id: <REDACTED>, host id: <REDACTED>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants