diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-15 23:10:16 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-15 23:10:16 -0600 |
commit | b6cec3789342c2408d878359d4ed07e3789611ac (patch) | |
tree | b1d9c1a5c783f0e7c97427d9b3770fae60fce7d1 /modules/caddyhttp/fileserver | |
parent | 48d723c07c52d76755ee323581a20777699f1557 (diff) |
caddyhttp: Add --debug flag to commands
file-server and reverse-proxy
This might be useful!
Diffstat (limited to 'modules/caddyhttp/fileserver')
-rw-r--r-- | modules/caddyhttp/fileserver/command.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/command.go b/modules/caddyhttp/fileserver/command.go index 902c5f8..6a77509 100644 --- a/modules/caddyhttp/fileserver/command.go +++ b/modules/caddyhttp/fileserver/command.go @@ -27,6 +27,7 @@ import ( "github.com/caddyserver/caddy/v2/modules/caddyhttp" caddytpl "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates" "github.com/caddyserver/certmagic" + "go.uber.org/zap" ) func init() { @@ -70,6 +71,7 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { browse := fs.Bool("browse") templates := fs.Bool("templates") accessLog := fs.Bool("access-log") + debug := fs.Bool("debug") var handlers []json.RawMessage @@ -130,6 +132,14 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { }, } + if debug { + cfg.Logging = &caddy.Logging{ + Logs: map[string]*caddy.CustomLog{ + "default": {Level: zap.DebugLevel.CapitalString()}, + }, + } + } + err := caddy.Run(cfg) if err != nil { return caddy.ExitCodeFailedStartup, err |