Beispiel #1
0
func startDaemon(c *cli.Context) {
	// set log level
	level := c.GlobalGeneric("debug").(*logLevel)
	logrus.SetLevel(level.value)
	logrus.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true})

	config, configFile, err := getConfig(c)
	if err != nil {
		logrus.Fatalf("failed to get configuration. Error: %v", err)
	}

	mgr, err := manager.NewManager(config, configFile)
	if err != nil {
		logrus.Fatalf("failed to initialize the manager. Error: %s", err)
	}

	// start manager's processing loop
	if err := mgr.Run(); err != nil {
		logrus.Fatalf("encountered an error: %s", err)
	}
}