feta/main.go

46 lines
784 B
Go
Raw Normal View History

2019-10-24 10:38:16 +00:00
package main
import (
"flag"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"golang.org/x/crypto/ssh/terminal"
"os"
)
var Version string
var Buildtime string
var Builduser string
var Buildarch string
func main() {
os.Exit(app())
}
func identify() {
2019-10-24 12:14:36 +00:00
log.Info().
2019-10-24 10:38:16 +00:00
Str("version", Version).
Str("buildarch", Buildarch).
Str("buildtime", Buildtime).
2019-10-24 12:14:36 +00:00
Str("builduser", Builduser).Send().
Msg("starting")
2019-10-24 10:38:16 +00:00
}
func app() int {
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:14:36 +00:00
return NewArchiver().Run()
2019-10-24 10:38:16 +00:00
}