Skip to content

Commit

Permalink
Minor log changes (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret authored Oct 29, 2024
1 parent f240c09 commit 73afe5a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/swerex/deployment/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def runtime(self) -> AbstractRuntime:
"""

def __del__(self):
"""Stops the runtime when the object is deleted."""
print("Stopping runtime because Deployment object is deleted")
asyncio.run(self.stop())


Expand Down
2 changes: 1 addition & 1 deletion src/swerex/runtime/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _check_bash_command(command: str) -> None:
stdout = result.stdout.decode(errors="backslashreplace")
stderr = result.stderr.decode(errors="backslashreplace")
msg = (
f"Error ({result.returncode}) while checking bash command \n{command!r}\n"
f"Error (exit code {result.returncode}) while checking bash command \n{command!r}\n"
f"Stderr: {stderr!r}\nStdout: {stdout!r}"
)
raise BashIncorrectSyntaxError(msg)
Expand Down
2 changes: 1 addition & 1 deletion src/swerex/runtime/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _api_url(self) -> str:
def _handle_transfer_exception(self, exc_transfer: _ExceptionTransfer) -> None:
"""Reraise exceptions that were thrown on the remote."""
if exc_transfer.traceback:
self.logger.debug("Traceback: %s", exc_transfer.traceback)
print("Traceback: ", exc_transfer.traceback, file=sys.stderr)
try:
module, _, exc_name = exc_transfer.class_path.rpartition(".")
exception = getattr(sys.modules[module], exc_name)
Expand Down
6 changes: 3 additions & 3 deletions src/swerex/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def get_logger(name: str) -> logging.Logger:
has_console_handler = any(isinstance(handler, logging.StreamHandler) for handler in logger.handlers)
if not has_console_handler:
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - 🦖 %(name)s - %(levelname)s - %(message)s")
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
return logger
return logger

0 comments on commit 73afe5a

Please sign in to comment.