summaryrefslogtreecommitdiffhomepage
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2024-03-05 19:03:59 -0500
committerGitHub <[email protected]>2024-03-05 17:03:59 -0700
commit0d44e3ecbaa0b16894e936068785e7fe32f41b48 (patch)
treed7e8ef2fcd16bae95e89bcaf94d1f359f8c7d451 /caddytest
parent2a78c9c5e428549fbb40b57b1bd78cf7746e37e3 (diff)
downloadcaddy-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 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/log_add.caddyfiletest71
-rw-r--r--caddytest/integration/caddyfile_adapt/log_except_catchall_blocks.caddyfiletest8
2 files changed, 75 insertions, 4 deletions
diff --git a/caddytest/integration/caddyfile_adapt/log_add.caddyfiletest b/caddytest/integration/caddyfile_adapt/log_add.caddyfiletest
new file mode 100644
index 000000000..4f91e4644
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/log_add.caddyfiletest
@@ -0,0 +1,71 @@
+:80 {
+ log
+
+ vars foo foo
+
+ log_append const bar
+ log_append vars foo
+ log_append placeholder {path}
+
+ log_append /only-for-this-path secret value
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":80"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "foo": "foo",
+ "handler": "vars"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "path": [
+ "/only-for-this-path"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "handler": "log_append",
+ "key": "secret",
+ "value": "value"
+ }
+ ]
+ },
+ {
+ "handle": [
+ {
+ "handler": "log_append",
+ "key": "const",
+ "value": "bar"
+ },
+ {
+ "handler": "log_append",
+ "key": "vars",
+ "value": "foo"
+ },
+ {
+ "handler": "log_append",
+ "key": "placeholder",
+ "value": "{http.request.uri.path}"
+ }
+ ]
+ }
+ ],
+ "logs": {}
+ }
+ }
+ }
+ }
+}
diff --git a/caddytest/integration/caddyfile_adapt/log_except_catchall_blocks.caddyfiletest b/caddytest/integration/caddyfile_adapt/log_except_catchall_blocks.caddyfiletest
index 6fbc6c7c8..e1362f8fb 100644
--- a/caddytest/integration/caddyfile_adapt/log_except_catchall_blocks.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/log_except_catchall_blocks.caddyfiletest
@@ -1,7 +1,7 @@
http://localhost:2020 {
log
- skip_log /first-hidden*
- skip_log /second-hidden*
+ log_skip /first-hidden*
+ log_skip /second-hidden*
respond 200
}
@@ -34,7 +34,7 @@ http://localhost:2020 {
"handle": [
{
"handler": "vars",
- "skip_log": true
+ "log_skip": true
}
],
"match": [
@@ -49,7 +49,7 @@ http://localhost:2020 {
"handle": [
{
"handler": "vars",
- "skip_log": true
+ "log_skip": true
}
],
"match": [