def get_localstack_logs() -> Union[str, Dict]: try: result = DOCKER_CLIENT.get_container_logs(get_main_container_name()) except Exception as e: result = "error getting docker logs for container: %s" % e return {"docker": result}
def is_up(self) -> bool: """ Checks whether the container is running, and the Ready marker has been printed to the logs. """ if not self.is_container_running(): return False logs = DOCKER_CLIENT.get_container_logs(self.container.name) if constants.READY_MARKER_OUTPUT not in logs.splitlines(): return False # also checks the edge port health status return super().is_up()
def cmd_logs(follow: bool): from localstack import config from localstack.utils.docker_utils import DOCKER_CLIENT container_name = config.MAIN_CONTAINER_NAME if not DOCKER_CLIENT.is_container_running(container_name): console.print("localstack container not running") sys.exit(1) if follow: for line in DOCKER_CLIENT.stream_container_logs(container_name): print(line.decode("utf-8").rstrip("\r\n")) else: print(DOCKER_CLIENT.get_container_logs(container_name))