Skip to content

Logging

This module contains functions to handle logging in the application.

FUNCTION DESCRIPTION
get_git_info

Get current git branch name, short commit hash, and commit datetime in UTC

get_package_info

Get package information (local, editable, source path)

log_version_info

Log version information of the package

start_logging

Start logging to file

Documentation last updated: 2025-06-11

get_git_info

get_git_info(
    directory: str = ".",
) -> tuple[str | None, str | None, datetime | None]

Get current git branch name, short commit hash, and commit datetime in UTC.

PARAMETER DESCRIPTION
directory

path to git repository. Defaults to '.'.

TYPE: str DEFAULT: '.'

RETURNS DESCRIPTION
tuple[str | None, str | None, datetime | None]

tuple[str|None, str|None]: branch name, short commit hash, commit datetime in UTC

get_package_info

get_package_info(
    package_name: str,
) -> tuple[bool, bool, Path | None]

Get package information (local, editable, source path)

PARAMETER DESCRIPTION
package_name

name of the package

TYPE: str

RETURNS DESCRIPTION
tuple[bool, bool, Path | None]

tuple[bool, bool, Path|None]: is_local, is_editable, source_path

log_version_info

log_version_info()

Log version information of the package

start_logging

start_logging(
    log_dir: Path | str | None = None,
    log_file: Path | str | None = None,
    log_config_file: Path | str | None = None,
    logging_config: dict | None = None,
) -> Path | None

Start logging to file. Default logging behavior is to log to file in current working directory.

PARAMETER DESCRIPTION
log_dir

log directory path. Defaults to None.

TYPE: Path | str | None DEFAULT: None

log_file

log file path. Defaults to None.

TYPE: Path | str | None DEFAULT: None

log_config_file

path to logging configuration file. Defaults to None.

TYPE: Path | str | None DEFAULT: None

logging_config

logging configuration. Defaults to None.

TYPE: dict | None DEFAULT: None

RETURNS DESCRIPTION
Path | None

Path|None: path to log file; None if logging_config is provided