func main() { var opts ShieldAgentOpts opts.Log = "Info" if err := goptions.Parse(&opts); err != nil { fmt.Printf("%s\n", err) goptions.PrintHelp() return } if opts.Help { goptions.PrintHelp() os.Exit(0) } if opts.Version { if Version == "" { fmt.Printf("shield-agent (development)%s\n", Version) } else { fmt.Printf("shield-agent v%s\n", Version) } os.Exit(0) } if opts.ConfigFile == "" { fmt.Fprintf(os.Stderr, "You must specify a configuration file via `--config`\n") os.Exit(1) } log.SetupLogging(log.LogConfig{Type: "console", Level: opts.Log}) log.Infof("starting agent") ag := agent.NewAgent() if err := ag.ReadConfig(opts.ConfigFile); err != nil { log.Errorf("configuration failed: %s", err) return } ag.Run() }
func main() { var opts ShieldAgentOpts opts.Log = "Info" if err := goptions.Parse(&opts); err != nil { fmt.Printf("%s\n", err) goptions.PrintHelp() return } log.SetupLogging(log.LogConfig{Type: "console", Level: opts.Log}) log.Infof("starting agent") ag := agent.NewAgent() if err := ag.ReadConfig(opts.ConfigFile); err != nil { log.Errorf("configuration failed: %s", err) return } ag.Run() }