Skip to content

Commit

Permalink
Enabled logging for Python API
Browse files Browse the repository at this point in the history
  • Loading branch information
AcerP-py committed Feb 4, 2025
1 parent 3b57690 commit 610eb81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/velocity/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from colorama import Fore, Style
from loguru import logger; logger.disable("velocity") # noqa: E702 # disable logging at the module level
from sys import stdout

from velocity._config import config # noqa: E402
from velocity._graph import ImageRepo # noqa: E402
Expand Down Expand Up @@ -128,5 +129,10 @@ def build(
builder.build()


# set up logging
logger.configure(handlers=[{"sink": stdout, "level": config.get("velocity:logging:level")}])
logger.enable("velocity")
logger.debug(config.get(""))

# visible attributes
__all__ = ["get_system", "set_system", "get_backend", "set_backend", "get_distro", "set_distro", "build"]
2 changes: 1 addition & 1 deletion src/velocity/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
config.set("velocity:distro", args.distro)

# setup logging and log startup
logger.enable("velocity")
logger.configure(handlers=[{"sink": sys.stdout, "level": config.get("velocity:logging:level")}])
logger.enable("velocity")
logger.debug("Starting velocity.")
logger.debug(config.get(""))

Expand Down
2 changes: 1 addition & 1 deletion src/velocity/_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def format_image_name(self, path: Path, tag: str) -> str:
return "{}{}".format(Path.joinpath(path, tag), ".sif" if ".sif" not in tag else "")

def clean_up_old_image_tag(self, name: str) -> str:
return "echo"
return "/usr/bin/env true"

def build_exists(self, name: str) -> bool:
if name not in self.existing_builds_cache:
Expand Down

0 comments on commit 610eb81

Please sign in to comment.