diff options
author | Francis Lavoie <[email protected]> | 2024-03-05 19:03:59 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-05 17:03:59 -0700 |
commit | 0d44e3ecbaa0b16894e936068785e7fe32f41b48 (patch) | |
tree | d7e8ef2fcd16bae95e89bcaf94d1f359f8c7d451 /caddyconfig | |
parent | 2a78c9c5e428549fbb40b57b1bd78cf7746e37e3 (diff) | |
download | caddy-0d44e3ecbaa0b16894e936068785e7fe32f41b48.tar.gz caddy-0d44e3ecbaa0b16894e936068785e7fe32f41b48.zip |
logging: Implement `log_append` handler (#6066)
* logging: Implement `extra_log` handler
* Rename to `log_append`
* Rename `skip_log` to `log_skip`
---------
Co-authored-by: Matt Holt <[email protected]>
Diffstat (limited to 'caddyconfig')
-rw-r--r-- | caddyconfig/httpcaddyfile/builtins.go | 17 | ||||
-rw-r--r-- | caddyconfig/httpcaddyfile/directives.go | 3 |
2 files changed, 14 insertions, 6 deletions
diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index 5040924df..505885d2d 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -49,7 +49,8 @@ func init() { RegisterDirective("handle_errors", parseHandleErrors) RegisterHandlerDirective("invoke", parseInvoke) RegisterDirective("log", parseLog) - RegisterHandlerDirective("skip_log", parseSkipLog) + RegisterHandlerDirective("skip_log", parseLogSkip) + RegisterHandlerDirective("log_skip", parseLogSkip) } // parseBind parses the bind directive. Syntax: @@ -1038,13 +1039,19 @@ func parseLogHelper(h Helper, globalLogNames map[string]struct{}) ([]ConfigValue return configValues, nil } -// parseSkipLog parses the skip_log directive. Syntax: +// parseLogSkip parses the log_skip directive. Syntax: // -// skip_log [<matcher>] -func parseSkipLog(h Helper) (caddyhttp.MiddlewareHandler, error) { +// log_skip [<matcher>] +func parseLogSkip(h Helper) (caddyhttp.MiddlewareHandler, error) { h.Next() // consume directive name + + // "skip_log" is deprecated, replaced by "log_skip" + if h.Val() == "skip_log" { + caddy.Log().Named("config.adapter.caddyfile").Warn("the 'skip_log' directive is deprecated, please use 'log_skip' instead!") + } + if h.NextArg() { return nil, h.ArgErr() } - return caddyhttp.VarsMiddleware{"skip_log": true}, nil + return caddyhttp.VarsMiddleware{"log_skip": true}, nil } diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go index 9a549a18e..13026fa4e 100644 --- a/caddyconfig/httpcaddyfile/directives.go +++ b/caddyconfig/httpcaddyfile/directives.go @@ -43,7 +43,8 @@ var directiveOrder = []string{ "vars", "fs", "root", - "skip_log", + "log_append", + "log_skip", "header", "copy_response_headers", // only in reverse_proxy's handle_response |