Skip to content

Commit

Permalink
Disable logging when using the programmatic interface (closes #126)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophetd committed Jun 16, 2022
1 parent 14bba84 commit bf7a2ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/stratus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ package main
import (
_ "github.com/datadog/stratus-red-team/internal/attacktechniques"
"github.com/spf13/cobra"
"log"
"os"
)

var rootCmd = &cobra.Command{
Use: "stratus",
}

func init() {
setupLogging()

listCmd := buildListCmd()
showCmd := buildShowCmd()
warmupCmd := buildWarmupCmd()
Expand All @@ -29,6 +33,10 @@ func init() {
rootCmd.AddCommand(versionCmd)
}

func setupLogging() {
log.SetOutput(os.Stdout)
}

func main() {
rootCmd.Execute()
}
7 changes: 7 additions & 0 deletions pkg/stratus/loader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ package loader

import (
_ "github.com/datadog/stratus-red-team/internal/attacktechniques" // Required for programmatic usage
"io"
"log"
)

func init() {
// Disable logging for programmatic usage
log.SetOutput(io.Discard)
}

0 comments on commit bf7a2ab

Please sign in to comment.