func _main()

in ccadb2OneCRL/main.go [100:136]


func _main() {
	err := SetLogOut()
	if err != nil {
		_, _ = fmt.Fprintf(os.Stderr, "failed to set logging out file, err: %v\n", err)
		os.Exit(1)
	}
	level, err := ParseLogLevel()
	if err != nil {
		_, _ = fmt.Fprintf(os.Stderr, "unexpected logging level %s\n", os.Getenv(LogLevel))
		_, _ = fmt.Fprint(os.Stderr, "expected one of either panic, fatal, error, warn, warning info, debug, trace")
		os.Exit(1)
	}
	log.SetLevel(level)
	// This gets us call site information, which is rather useful. It is also the reason
	// why we need to compile with go >= 1.15 (logrus needed a newer runtime API in order to pull it off, apparently).
	log.SetReportCaller(true)
	log.SetFormatter(&log.JSONFormatter{PrettyPrint: true})
	production, err := Production()
	if err != nil {
		log.WithField("production", os.Getenv(OneCRLProduction)).
			WithError(err).
			Fatal("failed to construct OneCRL production client")
	}
	staging, err := Staging()
	if err != nil {
		log.WithError(err).
			Fatal("failed to construct OneCRL staging client")
	}
	bugz := BugzillaClient()
	updater := NewUpdate(staging, production, bugz)
	err = updater.Update()
	if err != nil {
		log.WithError(err).Error("update failed")
		os.Exit(1)
	}
	log.Info("update completed")
}