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

@@ -67,7 +67,7 @@ func main() {
conf.GetConfig().Logs,
)
logger = logs.CreateLogger("oc-monitord")
logger = u.GetLogger()
logger.Debug().Msg("Loki URL : " + conf.GetConfig().LokiURL)
logger.Debug().Msg("Workflow executed : " + conf.GetConfig().ExecutionID)
@@ -124,13 +124,16 @@ func executeInside(execID string, ns string, argo_file_path string, stepMax int)
t, err := tools2.NewService(conf.GetConfig().Mode)
if err != nil {
logger.Error().Msg("Could not create KubernetesTool")
return
}
name, err := t.CreateArgoWorkflow(argo_file_path, ns)
if err != nil {
logger.Error().Msg("Could not create argo workflow : " + err.Error())
return
} else {
split := strings.Split(argo_file_path, "_")
argoLogs := models.NewArgoLogs(split[0], "argo", stepMax)
argoLogs := models.NewArgoLogs(workflowName, "argo", stepMax)
argoLogs.StartStepRecording(argoLogs.NewWatch(), wf_logger)
err := t.LogWorkflow(execID, ns, name, argo_file_path, stepMax, argoLogs.NewWatch(), argoLogs.NewWatch(), argoLogs, []string{}, logWorkflow)
if err != nil {