Skip to content

Commit e49c149

Browse files
committed
chore: change nix script to modify logs with env var
Also change logging level of curl
1 parent 0e56cb0 commit e49c149

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

docs/contributing.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ $ net-with-pg-13 python -m pytest -vv"
2525
You can turn on logging level to see curl traces with
2626

2727
```
28-
$ export LOGMIN=DEBUG1 # must be done outside nix-shell, then go in nix-shell as usual
29-
30-
$ nix-shell
31-
32-
$ net-with-pg-12 psql
28+
$ LOG_MIN_MESSAGES=debug2 net-with-pg-12 psql
3329
```
3430

3531
```sql

nix/pgScript.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{ postgresql, writeShellScriptBin } :
22

33
let
4-
LOGMIN = builtins.getEnv "LOGMIN";
5-
logMin = if builtins.stringLength LOGMIN == 0 then "INFO" else LOGMIN;
64
ver = builtins.head (builtins.splitVersion postgresql.version);
75
script = ''
86
set -euo pipefail
@@ -20,7 +18,7 @@ let
2018
2119
PGTZ=UTC initdb --no-locale --encoding=UTF8 --nosync -U "$PGUSER"
2220
23-
options="-F -c listen_addresses=\"\" -c log_min_messages=${logMin} -k $PGDATA"
21+
options="-F -c listen_addresses=\"\" -c log_min_messages=\"''${LOG_MIN_MESSAGES:-INFO}\" -k $PGDATA"
2422
2523
ext_options="-c shared_preload_libraries=\"pg_net\""
2624

src/worker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static void init_curl_handle(CURLM *curl_mhandle, CurlData *cdata, char *url, ch
193193
CURL_EZ_SETOPT(curl_ez_handle, CURLOPT_TIMEOUT_MS, timeout_milliseconds);
194194
CURL_EZ_SETOPT(curl_ez_handle, CURLOPT_PRIVATE, cdata);
195195
CURL_EZ_SETOPT(curl_ez_handle, CURLOPT_FOLLOWLOCATION, true);
196-
if (log_min_messages <= DEBUG1)
196+
if (log_min_messages <= DEBUG2)
197197
CURL_EZ_SETOPT(curl_ez_handle, CURLOPT_VERBOSE, 1L);
198198
#if LIBCURL_VERSION_NUM >= 0x075500 /* libcurl 7.85.0 */
199199
CURL_EZ_SETOPT(curl_ez_handle, CURLOPT_PROTOCOLS_STR, "http,https");

0 commit comments

Comments
 (0)