slackapi / node-slack-sdk

Slack Developer Kit for Node.js
https://tools.slack.dev/node-slack-sdk/
MIT License
3.27k stars 662 forks source link

Add more helpful information in web-api debug logging #1520

Closed seratch closed 1 year ago

seratch commented 2 years ago

As mentioned at https://github.com/slackapi/bolt-js/issues/1550 , debugging the web-api client ca be hard as its debug-level does not provide sufficient information.

When your app performs an apps.connections.open API call, the only information you can receive is blow:

[DEBUG]  web-api:WebClient:1 apiCall('apps.connections.open') start
[DEBUG]  web-api:WebClient:1 will perform http request
[DEBUG]  web-api:WebClient:1 http response received

Like Python and Java SDKs already do, we can add more meaningful information to the debug-level logging. One thing that we should be careful would be redact token data from the logging content. Refer to the following existing code for more details:

Packages:

Select all that apply:

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

srajiang commented 1 year ago

@seratch - Here's a stab at adding more logs:

apps.connections.open

Screen Shot 2022-10-25 at 3 59 22 PM

files.uploadV2

Screen Shot 2022-10-25 at 4 01 25 PM

Branch

Still need to redact bearer tokens from headers as well.

seratch commented 1 year ago

@srajiang Wow, your code already looks great! https://github.com/slackapi/node-slack-sdk/commit/d619ce0e290cc8cb3f1500282717ba24d0d5e410