package main import ( "context" "flag" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/crypto/ssh/terminal" "os" ) func main() { os.Exit(app()) } func app() int { log.Logger = log.With().Caller().Logger() if terminal.IsTerminal(int(os.Stdout.Fd())) { log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) } debug := flag.Bool("debug", false, "sets log level to debug") flag.Parse() identify() zerolog.SetGlobalLevel(zerolog.InfoLevel) if *debug { zerolog.SetGlobalLevel(zerolog.DebugLevel) } mainContext := context.Background() return NewArchiver(mainContext).RunForever() }