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

feat: WebClient/AsyncWebClient expose logger property #1671

Conversation

WilliamBergamin
Copy link
Contributor

Summary

This PR exposes the logger of WebClient and AsyncWebClient as a property.
This will be used in Bolt to resolve slackapi/bolt-python#1255, it will allow the reuse of the logger when copying the WebClient

Testing

client = WebClient(token="my_token")

client.logger.info("hello world")

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.36%. Comparing base (70685d3) to head (1f2c288).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1671      +/-   ##
==========================================
+ Coverage   85.32%   85.36%   +0.04%     
==========================================
  Files         113      113              
  Lines       12802    12808       +6     
==========================================
+ Hits        10923    10934      +11     
+ Misses       1879     1874       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

INFO:slack_sdk.web.base_client:LGTM!

I left a few comments around the tests though nothing blocking. This is a nice improvement! 🔍 🌲 ✨

@WilliamBergamin WilliamBergamin merged commit 27ced77 into main Mar 14, 2025
13 checks passed
@WilliamBergamin WilliamBergamin deleted the honnor-passing-bolt-logger-in-default-web-client-installation branch March 14, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The request-scoped WebClient doesn't use the provided logger
2 participants