Skip to content

Commit

Permalink
Add logger to main function
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronH88 committed Nov 28, 2024
1 parent aa2756f commit 708e096
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/receptor-cl/receptor.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package main

import (
"fmt"
"os"

"github.com/ansible/receptor/cmd"
"github.com/ansible/receptor/pkg/logger"
"github.com/ansible/receptor/pkg/netceptor"
)

func main() {
logger := logger.NewReceptorLogger("")

Check warning on line 12 in cmd/receptor-cl/receptor.go

View check run for this annotation

Codecov / codecov/patch

cmd/receptor-cl/receptor.go#L12

Added line #L12 was not covered by tests
var isV2 bool
newArgs := []string{}
for _, arg := range os.Args {
Expand All @@ -23,7 +24,7 @@ func main() {
os.Args = newArgs

if isV2 {
fmt.Println("Running v2 cli/config")
logger.Info("Running v2 cli/config")

Check warning on line 27 in cmd/receptor-cl/receptor.go

View check run for this annotation

Codecov / codecov/patch

cmd/receptor-cl/receptor.go#L27

Added line #L27 was not covered by tests
cmd.Execute()
} else {
cmd.RunConfigV1()
Expand All @@ -36,12 +37,12 @@ func main() {
}

if netceptor.MainInstance.BackendCount() == 0 {
netceptor.MainInstance.Logger.Warning("Nothing to do - no backends are running.\n")
fmt.Printf("Run %s --help for command line instructions.\n", os.Args[0])
logger.Warning("Nothing to do - no backends are running.\n")
logger.Warning("Run %s --help for command line instructions.\n", os.Args[0])

Check warning on line 41 in cmd/receptor-cl/receptor.go

View check run for this annotation

Codecov / codecov/patch

cmd/receptor-cl/receptor.go#L40-L41

Added lines #L40 - L41 were not covered by tests
os.Exit(1)
}

netceptor.MainInstance.Logger.Info("Initialization complete\n")
logger.Info("Initialization complete\n")

Check warning on line 45 in cmd/receptor-cl/receptor.go

View check run for this annotation

Codecov / codecov/patch

cmd/receptor-cl/receptor.go#L45

Added line #L45 was not covered by tests

<-netceptor.MainInstance.NetceptorDone()
}

0 comments on commit 708e096

Please sign in to comment.