Skip to content

🔧 Replace deprecated logging.warn() with logging.warning() #121

@anthropic-code-agent

Description

@anthropic-code-agent

Description

In nw_server_status/server_status.py, the code uses the deprecated logging.warn() method instead of the correct logging.warning().

Location

File: nw_server_status/server_status.py
Line: 104

Current Code

logging.warn(f"Skipping {guild}...")  # ❌ Deprecated

Impact

  • Generates DeprecationWarning in Python 3.x
  • logging.warn() has been deprecated since Python 3.2
  • May be removed in future Python versions, breaking the code

Fix Required

Replace with the correct method:

logging.warning(f"Skipping {guild}...")  # ✅ Correct

Priority

MEDIUM - Code still works but uses deprecated API.

Reference

From Python documentation:

Logger.warn() - Deprecated since Python 3.3, use warning() instead.

See: https://docs.python.org/3/library/logging.html#logging.Logger.warning

Testing

After fixing:

  1. Run the code and verify no deprecation warnings appear
  2. Verify logging still works correctly

Additional Notes

It's a simple one-line fix but improves code quality and future-proofing.

Related

This is part of a comprehensive code review. See other issues for additional improvements.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions