package main import ( "git.beejay.kim/WatchDog/ward/app/daemon" "git.beejay.kim/WatchDog/ward/version" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/urfave/cli/v2" "os" "time" ) var app *cli.App func init() { // Default log level is info, unless debug flag is present zerolog.SetGlobalLevel(zerolog.InfoLevel) zerolog.TimeFieldFormat = zerolog.TimeFormatUnix log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) app = &cli.App{ Name: version.Name, Version: version.BuildVersion, EnableBashCompletion: true, Compiled: time.Now(), Authors: []*cli.Author{ { Name: "BeeJay Kim", Email: "i@beejay.kim", }, }, Copyright: "(c) 2024 BeeJay Kim", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "debug", Usage: "sets log level to debug", Aliases: []string{"D"}, Action: func(ctx *cli.Context, debug bool) error { zerolog.SetGlobalLevel(zerolog.DebugLevel) return nil }, }, }, Commands: []*cli.Command{ &daemon.Command, }, } } func main() { if err := app.Run(os.Args); err != nil { log.Err(err).Send() } }