@chimoney.io/iaas-k8s-deployment
Version:
Kubernetes Infrastructure as a Service deployment package for streamlined multi-cloud environments
37 lines (32 loc) • 828 B
text/typescript
import type {
Logger,
DeploymentProgress,
DeploymentStatus,
} from "../../types/index.js";
// =============================================================================
// Progress Tracking
// =============================================================================
export function createProgressCallback(
logger: Logger,
onProgress?: (progress: DeploymentProgress) => void
) {
return (
status: DeploymentStatus,
message: string,
metadata?: Record<string, any>
) => {
const progress: DeploymentProgress = {
status,
message,
timestamp: new Date(),
metadata,
};
logger.info(`[${status.toUpperCase()}] ${message}`);
if (metadata) {
logger.debug("Progress metadata:", metadata);
}
if (onProgress) {
onProgress(progress);
}
};
}