Skip to content

fix(socket_mode): check the effective log level in debug guards - #1965

Open
Shubham-Padkonde wants to merge 1 commit into
slackapi:mainfrom
Shubham-Padkonde:fix/socket-mode-debug-guards
Open

Shubham-Padkonde wants to merge 1 commit into
slackapi:mainfrom
Shubham-Padkonde:fix/socket-mode-debug-guards

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes the Socket Mode part of #1957.

The debug guards compared logger.level, which stays NOTSET unless a level is set on that exact logger, so the guarded messages (including debug_redacted_message_string(message) for every inbound message) were built even when DEBUG was disabled through a parent logger. They now use isEnabledFor(logging.DEBUG), which follows the effective level.

I kept this to slack_sdk/socket_mode/; the same pattern in the other modules can follow separately if you want it project-wide.

The added test checks that the message is not built when a parent logger is at INFO and is built at DEBUG; it fails before this change. The Socket Mode test suites (sync and async), ruff and mypy pass.

🤖 Generated with Claude Code

The debug guards compared logger.level, which is NOTSET unless a level
is set on that exact logger, so the guarded messages were built even
when DEBUG is disabled through a parent logger. Use isEnabledFor(),
which follows the effective level.

Refs slackapi#1957

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Shubham-Padkonde
Shubham-Padkonde requested a review from a team as a code owner September 19, 2026 04:13
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.

1 participant