moved the logger creation to the utils package to make them available to all packages without recreating or passing them

This commit is contained in:
pb
2025-04-15 11:40:44 +02:00
parent 04d6001fec
commit 31580f1905
3 changed files with 33 additions and 3 deletions

View File

@@ -66,6 +66,8 @@ func (k *KubernetesTools) LogWorkflow(execID string, namespace string, workflowN
return errors.New("Could not retrieve workflow ID from execution ID " + execID)
}
if exec.State == enum.DRAFT || exec.State == enum.FAILURE || exec.State == enum.SUCCESS {
l := utils.GetWFLogger("")
l.Error().Msg("The execution's state doesn't meet requirement, state is : " + exec.State.String())
return nil
}
k.logWorkflow(namespace, workflowName, argoFilePath, stepMax, current_watch, previous_watch, argoLogs, seen, logFunc)
@@ -76,6 +78,7 @@ func (k *KubernetesTools) logWorkflow(namespace string, workflowName string, arg
seen []string,
logFunc func(argoFilePath string, stepMax int, pipe io.ReadCloser, current_watch *models.ArgoWatch, previous_watch *models.ArgoWatch, argoLogs *models.ArgoLogs, seen []string, wg *sync.WaitGroup)) error {
// List pods related to the Argo workflow
fmt.Println("\n!!!!!!!! !!!!!!!!!! !!!!!!!! &&&& & STARTING LOG\n\n")
labelSelector := fmt.Sprintf("workflows.argoproj.io/workflow=%s", workflowName)
for retries := 0; retries < 10; retries++ { // Retry for up to ~20 seconds
// List workflow pods