update_manager: improve logging

Add a debug logging helper to the base class.  Use unique
logging prefixes for subclasses of AppDeploy.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-02-25 19:26:38 -05:00
parent 4edfbce3ce
commit 1cfeb853a5
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
4 changed files with 10 additions and 4 deletions

View File

@ -48,8 +48,10 @@ DISTRO_ALIASES = [distro.id()]
DISTRO_ALIASES.extend(distro.like().split())
class AppDeploy(BaseDeploy):
def __init__(self, config: ConfigHelper, cmd_helper: CommandHelper) -> None:
super().__init__(config, cmd_helper, prefix="Application")
def __init__(
self, config: ConfigHelper, cmd_helper: CommandHelper, prefix: str
) -> None:
super().__init__(config, cmd_helper, prefix=prefix)
self.config = config
type_choices = list(TYPE_TO_CHANNEL.keys())
self.type = config.get('type').lower()

View File

@ -91,6 +91,10 @@ class BaseDeploy:
log_msg = f"{self.prefix}{msg}"
logging.info(log_msg)
def log_debug(self, msg: str) -> None:
log_msg = f"{self.prefix}{msg}"
logging.debug(log_msg)
def notify_status(self, msg: str, is_complete: bool = False) -> None:
log_msg = f"{self.prefix}{msg}"
logging.debug(log_msg)

View File

@ -30,7 +30,7 @@ if TYPE_CHECKING:
class GitDeploy(AppDeploy):
def __init__(self, config: ConfigHelper, cmd_helper: CommandHelper) -> None:
super().__init__(config, cmd_helper)
super().__init__(config, cmd_helper, "Git Repo")
self._configure_path(config)
self._configure_virtualenv(config)
self._configure_dependencies(config)

View File

@ -36,7 +36,7 @@ RINFO_KEYS = [
class ZipDeploy(AppDeploy):
def __init__(self, config: ConfigHelper, cmd_helper: CommandHelper) -> None:
super().__init__(config, cmd_helper)
super().__init__(config, cmd_helper, "Zip Dist")
self._configure_path(config)
self._configure_virtualenv(config)
self._configure_dependencies(config, node_only=True)