From 13f541469198e29f9a16f54aeecf7b55cea629c8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 11 Feb 2020 18:39:52 +0100 Subject: cmd/koushin: add -debug flag --- cmd/koushin/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/koushin/main.go b/cmd/koushin/main.go index afdf7f3..392150f 100644 --- a/cmd/koushin/main.go +++ b/cmd/koushin/main.go @@ -23,9 +23,10 @@ func main() { var addr string flag.StringVar(&options.Theme, "theme", "", "default theme") flag.StringVar(&addr, "addr", ":1323", "listening address") + flag.BoolVar(&options.Debug, "debug", false, "enable debug logs") flag.Usage = func() { - fmt.Fprintf(flag.CommandLine.Output(), "usage: koushin [options...] \n") + fmt.Fprintf(flag.CommandLine.Output(), "usage: koushin [options...] \n") flag.PrintDefaults() } @@ -48,6 +49,10 @@ func main() { } e.Use(middleware.Recover()) + if options.Debug { + e.Logger.SetLevel(log.DEBUG) + } + sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGUSR1) go func() { -- cgit v1.2.3