Skip to content

Commit

Permalink
RSDK-7933 fix logging bugs (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
purplenicole730 committed Jul 3, 2024
1 parent e419975 commit b27ca9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/viam/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def handle_task_result(self, task: asyncio.Task):
def emit(self, record: logging.LogRecord):
assert isinstance(record, logging.LogRecord)
name = record.name.split(".")[-1]
message = f"{record.filename}:{record.lineno}\t{record.msg}"
message = f"{record.filename}:{record.lineno}\t{record.getMessage()}"
stack = f"exc_info: {record.exc_info}, exc_text: {record.exc_text}, stack_info: {record.stack_info}"
time = datetime.fromtimestamp(record.created)

Expand Down
6 changes: 3 additions & 3 deletions src/viam/robot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ async def stop_all(self, extra: Dict[ResourceName, Dict[str, Any]] = {}):
# LOG #
#######

async def log(self, name: str, level: str, time: datetime, log: str, stack: str):
async def log(self, name: str, level: str, time: datetime, message: str, stack: str):
"""Send log from Python module over gRPC.
Create a LogEntry object from the log to send to RDK.
Expand All @@ -802,12 +802,12 @@ async def log(self, name: str, level: str, time: datetime, log: str, stack: str)
name (str): The logger's name.
level (str): The level of the log.
time (datetime): The log creation time.
log (str): The log message.
message (str): The log message.
stack (str): The stack information of the log.
For more information, see `Machine Management API <https://docs.viam.com/appendix/apis/robot/>`_.
"""
entry = LogEntry(level=level, time=datetime_to_timestamp(time), logger_name=name, message=log, stack=stack)
entry = LogEntry(level=level, time=datetime_to_timestamp(time), logger_name=name, message=message, stack=stack)
request = LogRequest(logs=[entry])
await self._client.Log(request)

Expand Down

0 comments on commit b27ca9b

Please sign in to comment.