Skip to content

Commit 0a11b86

Browse files
committed
Add a name argument to LoggingConfigUpdatingActor
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent a18650f commit 0a11b86

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
## New Features
1515

16-
<!-- Here goes the main new features and examples or instructions on how to use them -->
16+
- `LoggingConfigUpdatingActor`
17+
18+
* Added a new `name` argument to the constructor to be able to override the actor's name.
1719

1820
## Bug Fixes
1921

src/frequenz/sdk/config/_logging_actor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,24 @@ def __init__(
137137
config_recv: Receiver[Mapping[str, Any]],
138138
log_format: str = "%(asctime)s %(levelname)-8s %(name)s:%(lineno)s: %(message)s",
139139
log_datefmt: str = "%Y-%m-%dT%H:%M:%S%z",
140+
name: str | None = None,
140141
):
141142
"""Initialize this instance.
142143
143144
Args:
144145
config_recv: The receiver to listen for configuration changes.
145146
log_format: Use the specified format string in logs.
146147
log_datefmt: Use the specified date/time format in logs.
148+
name: The name of this actor. If `None`, `str(id(self))` will be used. This
149+
is used mostly for debugging purposes.
147150
148151
Note:
149152
The `log_format` and `log_datefmt` parameters are used in a call to
150153
`logging.basicConfig()`. If logging has already been configured elsewhere
151154
in the application (through a previous `basicConfig()` call), then the format
152155
settings specified here will be ignored.
153156
"""
154-
super().__init__()
157+
super().__init__(name=name)
155158
self._config_recv = config_recv
156159

157160
# Setup default configuration.

0 commit comments

Comments
 (0)