introduced logging
Some checks failed
Go Tests / go-tests (push) Failing after 1m4s

This commit is contained in:
Manuel Ganter 2025-09-05 11:45:04 +02:00
parent 8884165ffe
commit 044f1b04b8
No known key found for this signature in database
5 changed files with 34 additions and 19 deletions

12
main.go
View file

@ -17,6 +17,7 @@ package main
import (
"context"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@ -31,7 +32,6 @@ var signals = []os.Signal{
}
func main() {
ctx, stop := signal.NotifyContext(context.Background(), signals...)
defer stop()
@ -41,12 +41,20 @@ func main() {
os.Exit(1)
}
prov, err := provider.NewEdgeConnectProvider(executionEnv.ProviderConfigFile, executionEnv.ControllerID)
prov, logFilePath, err := provider.NewEdgeConnectProvider(executionEnv.ProviderConfigFile, executionEnv.ControllerID)
if err != nil {
fmt.Fprintf(os.Stderr, "Error creating provider: %q", err)
os.Exit(1)
}
logFile, err := os.OpenFile(logFilePath, os.O_APPEND|os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
log.Panic(err)
}
defer logFile.Close()
// set log out put
log.SetOutput(logFile)
result, err := executionEnv.Run(ctx, prov)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to run command: %+v\n", err)