INNER CODE UNIT · Go
main
karmada-io/karmada · cmd/agent/main.go:31
func main() {
ctx := controllerruntime.SetupSignalHandler()
// Starting from version 0.15.0, controller-runtime expects its consumers to set a logger through log.SetLogger.
// If SetLogger is not called within the first 30 seconds of a binaries lifetime, it will get
// set to a NullLogSink and report an error. Here's to silence the "log.SetLogger(...) was never called; logs will not be displayed" error
// by setting a logger through log.SetLogger.
// More info refer to: https://github.com/karmada-io/karmada/pull/4885.
controllerruntime.SetLogger(klog.Background())
cmd := app.NewAgentCommand(ctx)
code := cli.Run(cmd)
// Ensure any buffered log entries are flushed
logs.FlushLogs()
os.Exit(code)
}