Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changes/unreleased/added-20260205-163010.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: added
body: Change header print messages to info log
time: 2026-02-05T16:30:10.310834+02:00
custom:
Author: mwc360
AuthorLink: https://github.com/mwc360
Issue: "771"
IssueLink: https://github.com/microsoft/fabric-cicd/issues/771
17 changes: 9 additions & 8 deletions src/fabric_cicd/_common/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,20 @@ def exception_handler(exception_type: type[BaseException], exception: BaseExcept
sys.__excepthook__(exception_type, exception, traceback)


def print_header(message: str) -> None:
def log_header(logger: logging.Logger, message: str) -> None:
"""
Prints a header message with a decorative line above and below it.
Logs a header message with a decorative line above and below it.

Args:
message: The header message to print.
logger: The logger to use for logging the header message.
message: The header message to log.
"""
line_separator = "#" * 100
formatted_message = f"########## {message}"
formatted_message = f"{formatted_message} {line_separator[len(formatted_message) + 1 :]}"

print() # Print a blank line before the header
print(f"{Fore.GREEN}{Style.BRIGHT}{line_separator}{Style.RESET_ALL}")
print(f"{Fore.GREEN}{Style.BRIGHT}{formatted_message}{Style.RESET_ALL}")
print(f"{Fore.GREEN}{Style.BRIGHT}{line_separator}{Style.RESET_ALL}")
print()
logger.info("") # Log a blank line before the header
logger.info(f"{Fore.GREEN}{Style.BRIGHT}{line_separator}{Style.RESET_ALL}")
logger.info(f"{Fore.GREEN}{Style.BRIGHT}{formatted_message}{Style.RESET_ALL}")
logger.info(f"{Fore.GREEN}{Style.BRIGHT}{line_separator}{Style.RESET_ALL}")
logger.info("")
6 changes: 3 additions & 3 deletions src/fabric_cicd/fabric_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from fabric_cicd._common._exceptions import FailedPublishedItemStatusError, InputError, ParameterFileError, ParsingError
from fabric_cicd._common._fabric_endpoint import FabricEndpoint, _generate_fabric_credential, _is_fabric_runtime
from fabric_cicd._common._item import Item
from fabric_cicd._common._logging import print_header
from fabric_cicd._common._logging import log_header
from fabric_cicd.constants import FeatureFlag, ItemType

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -242,7 +242,7 @@ def _refresh_parameter_file(self) -> None:
"""Load parameters if file is present."""
from fabric_cicd._parameter._parameter import Parameter

print_header("Validating Parameter File")
log_header(logger, "Validating Parameter File")

# Initialize the parameter dict and Parameter object
self.environment_parameter = {}
Expand Down Expand Up @@ -827,7 +827,7 @@ def _publish_folders(self) -> None:
"""Publishes all folders from the repository."""
# Sort folders by the number of '/' in their paths (ascending order)
sorted_folders = sorted(self.repository_folders.keys(), key=lambda path: path.count("/"))
print_header("Publishing Workspace Folders")
log_header(logger, "Publishing Workspace Folders")
logger.info("Publishing Workspace Folders")
for folder_path in sorted_folders:
if folder_path in self.deployed_folders:
Expand Down
10 changes: 5 additions & 5 deletions src/fabric_cicd/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
load_config_file,
)
from fabric_cicd._common._exceptions import FailedPublishedItemStatusError, InputError
from fabric_cicd._common._logging import print_header
from fabric_cicd._common._logging import log_header
from fabric_cicd._common._validate_input import (
validate_environment,
validate_fabric_workspace_obj,
Expand Down Expand Up @@ -190,15 +190,15 @@ def publish_all_items(
total_item_types = len(constants.SERIAL_ITEM_PUBLISH_ORDER)
publishers_with_async_check: list[items.ItemPublisher] = []
for order_num, item_type in items.ItemPublisher.get_item_types_to_publish(fabric_workspace_obj):
print_header(f"Publishing Item {order_num}/{total_item_types}: {item_type.value}")
log_header(logger, f"Publishing Item {order_num}/{total_item_types}: {item_type.value}")
publisher = items.ItemPublisher.create(item_type, fabric_workspace_obj)
publisher.publish_all()
if publisher.has_async_publish_check:
publishers_with_async_check.append(publisher)

# Check asynchronous publish status for relevant item types
for publisher in publishers_with_async_check:
print_header(f"Checking {publisher.item_type} Publish State")
log_header(logger, f"Checking {publisher.item_type} Publish State")
publisher.post_publish_all_check()

# Return response data if feature flag is enabled and responses were collected
Expand Down Expand Up @@ -266,7 +266,7 @@ def unpublish_all_orphan_items(

fabric_workspace_obj._refresh_deployed_items()
fabric_workspace_obj._refresh_repository_items()
print_header("Unpublishing Orphaned Items")
log_header(logger, "Unpublishing Orphaned Items")

# Build unpublish order based on reversed publish order, scope, and feature flags
for item_type in items.ItemPublisher.get_item_types_to_unpublish(fabric_workspace_obj):
Expand Down Expand Up @@ -361,7 +361,7 @@ def deploy_with_config(
msg = "Config file-based deployment is currently an experimental feature. Both 'enable_experimental_features' and 'enable_config_deploy' feature flags must be set."
raise InputError(msg, logger)

print_header("Config-Based Deployment")
log_header(logger, "Config-Based Deployment")
logger.info(f"Loading configuration from {config_file_path} for environment '{environment}'")

# Validate environment
Expand Down