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

Fix #496 Add clientOptions.logger option (and improvements to other attributes too) #856

Merged
merged 3 commits into from
Mar 25, 2021

Conversation

seratch
Copy link
Member

@seratch seratch commented Mar 24, 2021

Summary

This pull request resolves #496 by passing logger to WebClient instance. Also, I've improved the initialization of other attributes.

Requirements (place an x in each [ ])

@seratch seratch added the enhancement M-T: A feature request for new functionality label Mar 24, 2021
@seratch seratch added this to the 3.4.0 milestone Mar 24, 2021
@seratch seratch requested review from mwbrooks and stevengill March 24, 2021 14:12
@seratch seratch self-assigned this Mar 24, 2021
@codecov
Copy link

codecov bot commented Mar 24, 2021

Codecov Report

Merging #856 (d91c13a) into main (afcd7bd) will decrease coverage by 0.10%.
The diff coverage is 60.00%.

❗ Current head d91c13a differs from pull request most recent head 4cf04d2. Consider uploading reports for the commit 4cf04d2 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #856      +/-   ##
==========================================
- Coverage   65.98%   65.87%   -0.11%     
==========================================
  Files          13       13              
  Lines        1176     1184       +8     
  Branches      344      348       +4     
==========================================
+ Hits          776      780       +4     
- Misses        334      336       +2     
- Partials       66       68       +2     
Impacted Files Coverage Δ
src/App.ts 82.84% <60.00%> (-0.80%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afcd7bd...4cf04d2. Read the comment docs.

Copy link
Member Author

@seratch seratch left a comment

Choose a reason for hiding this comment

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

comments for reviewers

Comment on lines +242 to +247
if (agent !== undefined && this.clientOptions.agent === undefined) {
this.clientOptions.agent = agent;
}
if (clientTls !== undefined && this.clientOptions.tls === undefined) {
this.clientOptions.tls = clientTls;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

In the past versions, clientOptions.agent was overwritten if agent exists in the App constructor arguments. This is the same for clientOptions.tls vs clientTls.

src/App.ts Outdated
this.clientOptions.tls = clientTls;
}
if (logLevel !== undefined && logger === undefined) {
// If the constructor has both, logLevel is ignored
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this can affect many existing apps but this is for keeping backward compatibility (just in case).

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we warn the developer in this case in case there's confusion?

Copy link
Member Author

Choose a reason for hiding this comment

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

It sounds nice 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

done

this.clientOptions.logLevel = logLevel;
} else {
// Since v3.4, WebClient starts sharing loggger with App
this.clientOptions.logger = this.logger;
Copy link
Member Author

Choose a reason for hiding this comment

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

The visible change would be the name of logger. I think it's better for most apps.

@seratch seratch changed the title Fix #496 Add clientOptions.logger option Fix #496 Add clientOptions.logger option (and improvements to other attributes too) Mar 24, 2021
@seratch seratch merged commit c05b156 into slackapi:main Mar 25, 2021
@seratch seratch deleted the issue-496-clientOptions branch March 25, 2021 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality semver:minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add clientOptions.logger option
3 participants