Skip to content

Commit 86c5cfe

Browse files
committed
Move logger configuration into PluginManager.register_action
1 parent 71ddbe0 commit 86c5cfe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

streamdeck/__main__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ def main():
224224
)
225225

226226
for action in actions:
227-
# Configure a logger for each action, giving it the last part of its uuid as logger name.
228-
action_component_name = action.uuid.split(".")[-1]
229-
configure_streamdeck_logger(name=action_component_name, plugin_uuid=plugin_uuid)
230-
231227
manager.register_action(action)
232228

233229
manager.run()

streamdeck/manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from streamdeck.actions import ActionRegistry
88
from streamdeck.command_sender import StreamDeckCommandSender
99
from streamdeck.models.events import event_adapter
10+
from streamdeck.utils.logging import configure_streamdeck_logger
1011
from streamdeck.websocket import WebSocketClient
1112

1213

@@ -55,11 +56,15 @@ def __init__(
5556
self._registry = ActionRegistry()
5657

5758
def register_action(self, action: Action) -> None:
58-
"""Register an action with the PluginManager.
59+
"""Register an action with the PluginManager, and configure its logger.
5960
6061
Args:
6162
action (Action): The action to register.
6263
"""
64+
# First, configure a logger for the action, giving it the last part of its uuid as name.
65+
action_component_name = action.uuid.split(".")[-1]
66+
configure_streamdeck_logger(name=action_component_name, plugin_uuid=self.uuid)
67+
6368
self._registry.register(action)
6469

6570
def run(self) -> None:

0 commit comments

Comments
 (0)