2019-10-24 10:38:16 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-10-24 12:41:05 +00:00
|
|
|
"context"
|
2019-10-24 10:38:16 +00:00
|
|
|
"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 {
|
2019-10-24 12:41:05 +00:00
|
|
|
log.Logger = log.With().Caller().Logger()
|
2019-10-24 10:38:16 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2019-10-24 12:41:05 +00:00
|
|
|
mainContext := context.Background()
|
2019-10-29 18:48:53 +00:00
|
|
|
return NewArchiver(mainContext).RunForever()
|
2019-10-24 10:38:16 +00:00
|
|
|
}
|