Skip to content

Commit 0970c72

Browse files
authored
Include receiver name in its string representation (#439)
The string representation of a receiver is used in logging, and without this, it is impossible to identify which receiver is meant, from looking at the logs.
2 parents 877eedf + e88f201 commit 0970c72

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
## Bug Fixes
1616

1717
- Fix `NopReceiver.ready()` to properly terminate when receiver is closed.
18+
19+
- The `__str__` representation of broadcast receivers now include the receiver's name.

src/frequenz/channels/_broadcast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def close(self) -> None:
515515

516516
def __str__(self) -> str:
517517
"""Return a string representation of this receiver."""
518-
return f"{self._channel}:{type(self).__name__}"
518+
return f"{self._channel}:{type(self).__name__}:{self._name}"
519519

520520
def __repr__(self) -> str:
521521
"""Return a string representation of this receiver."""

0 commit comments

Comments
 (0)