Small: Log requests body (#913)

Add body in log requests.

GRIST_LOG_SKIP_HTTP is a badly named environment variable and its
expected values are confusing (to log the requests, you actually have to
set its value to "", and setting to "false" actually is equivalent to
setting to "true").

We deprecate this env variable in favor of GRIST_LOG_HTTP which is more
convenient and understandable:
 - by default, its undefined, so nothing is logged;
 - to enable the logs, you just have to set GRIST_LOG_HTTP=true

Also this commit removes the default value for GRIST_LOG_SKIP_HTTP,
because we don't have to set it to "true" to actually disable the
requests logging thanks to GRIST_LOG_HTTP. FlexServer now handles
the historical behavior for this deprecated variable.

---------

Co-authored-by: Jonathan Perret <j-github@jonathanperret.net>
This commit is contained in:
Florent
2024-08-27 12:38:35 +02:00
committed by GitHub
parent 8b48d1bc33
commit 76fcfd733e
4 changed files with 45 additions and 5 deletions

View File

@@ -31,6 +31,8 @@ cleanup() {
GRIST_LOG_LEVEL="error"
if [[ "${DEBUG:-}" == 1 ]]; then
GRIST_LOG_LEVEL=""
GRIST_LOG_HTTP="true"
GRIST_LOG_HTTP_BODY="true"
fi
docker run --name $DOCKER_CONTAINER --rm \
@@ -39,7 +41,8 @@ docker run --name $DOCKER_CONTAINER --rm \
--env GRIST_SESSION_COOKIE=grist_test_cookie \
--env GRIST_TEST_LOGIN=1 \
--env GRIST_LOG_LEVEL=$GRIST_LOG_LEVEL \
--env GRIST_LOG_SKIP_HTTP=${DEBUG:-false} \
--env GRIST_LOG_HTTP=${GRIST_LOG_HTTP:-false} \
--env GRIST_LOG_HTTP_BODY=${GRIST_LOG_HTTP_BODY:-false} \
--env TEST_SUPPORT_API_KEY=api_key_for_support \
--env GRIST_TEMPLATE_ORG=templates \
${TEST_IMAGE:-gristlabs/grist} &