1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  | 
diff --git a/cmd/ugitd/args.go b/cmd/ugitd/args.go
index a1a0e46ffecc4167880a9d9a77c26d8338d56d4f..32f682cb7eea8595baac966014d69e5b9c36863d 100644
--- a/cmd/ugitd/args.go
+++ b/cmd/ugitd/args.go
@@ -5,17 +5,18 @@ 	"flag"
 	"fmt"
 	"strings"
 
+	"github.com/charmbracelet/log"
 	"github.com/peterbourgon/ff/v3"
 	"github.com/peterbourgon/ff/v3/ffyaml"
 )
 
 type cliArgs struct {
-	Debug   bool
 	RepoDir string
 	SSH     sshArgs
 	HTTP    httpArgs
 	Meta    metaArgs
 	Profile profileArgs
+	Log     logArgs
 }
 
 type sshArgs struct {
@@ -46,6 +47,11 @@ 	Name string
 	URL  string
 }
 
+type logArgs struct {
+	Level log.Level
+	JSON  bool
+}
+
 func parseArgs(args []string) (c cliArgs, e error) {
 	fs := flag.NewFlagSet("ugitd", flag.ContinueOnError)
 	fs.String("config", "ugit.yaml", "Path to config file")
@@ -65,10 +71,21 @@ 		},
 		Meta: metaArgs{
 			Title:       "ugit",
 			Description: "Minimal git server",
+		},
+		Log: logArgs{
+			Level: log.InfoLevel,
 		},
 	}
 
-	fs.BoolVar(&c.Debug, "debug", c.Debug, "Debug logging")
+	fs.Func("log.level", "Logging level", func(s string) error {
+		lvl, err := log.ParseLevel(s)
+		if err != nil {
+			return err
+		}
+		c.Log.Level = lvl
+		return nil
+	})
+	fs.BoolVar(&c.Log.JSON, "log.json", c.Log.JSON, "Print logs in JSON(L) format")
 	fs.StringVar(&c.RepoDir, "repo-dir", c.RepoDir, "Path to directory containing repositories")
 	fs.StringVar(&c.SSH.AuthorizedKeys, "ssh.authorized-keys", c.SSH.AuthorizedKeys, "Path to authorized_keys")
 	fs.StringVar(&c.SSH.CloneURL, "ssh.clone-url", c.SSH.CloneURL, "SSH clone URL base")
  |