Skip to content

Commit e3296b5

Browse files
Change get_logs to get_current_invocation_logs
Co-authored-by: Richard Bowman <richard.bowman@cantab.net>
1 parent c584750 commit e3296b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/labthings_fastapi/thing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def observe_action(self, action_name: str, stream: ObjectSendStream) -> None:
384384
observers = action._observers_set(self)
385385
observers.add(stream)
386386

387-
def get_logs(self) -> list[logging.LogRecord]:
387+
def get_current_invocation_logs(self) -> list[logging.LogRecord]:
388388
"""Get the log records for an on going action.
389389
390390
This is useful if an action wishes to save its logs alongside any data.

tests/test_logs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def log_a_message(self, msg: str):
3131

3232
@lt.action
3333
def log_and_capture(self, msg: str) -> str:
34-
"""Log a message to the thing's logger."""
34+
"""Log a message to the thing's logger and retrieve it as a string."""
3535
self.logger.info(msg)
3636
self.logger.warning(msg)
3737
self.logger.error(msg)
38-
logs = self.get_logs()
38+
logs = self.get_current_invocation_logs()
3939
logging_str = ""
4040
for record in logs:
4141
level = record.levelname

0 commit comments

Comments
 (0)