diff --git a/main.go b/main.go index dc738e5..8df2659 100644 --- a/main.go +++ b/main.go @@ -68,7 +68,13 @@ func buildCommand(out io.Writer) command.Command { flagVerbose bool flagJSON bool ) - c := command.New(out, log.Printf, "fortify", func([]string) error { fmsg.Store(flagVerbose); return nil }). + c := command.New(out, log.Printf, "fortify", func([]string) error { + fmsg.Store(flagVerbose) + if flagVerbose { + seccomp.CPrintln = log.Println + } + return nil + }). Flag(&flagVerbose, "v", command.BoolFlag(false), "Print debug messages to the console"). Flag(&flagJSON, "json", command.BoolFlag(false), "Serialise output as JSON when applicable") @@ -285,10 +291,6 @@ func runApp(a fst.App, config *fst.Config) { syscall.SIGINT, syscall.SIGTERM) defer stop() // unreachable - if fmsg.Load() { - seccomp.CPrintln = log.Println - } - if sa, err := a.Seal(config); err != nil { fmsg.PrintBaseError(err, "cannot seal app:") internal.Exit(1)