logging: Also add the command prefix to detail and hint messages
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 30 May 2022 05:18:57 +0000 (07:18 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 30 May 2022 05:26:06 +0000 (07:26 +0200)
This makes the output line up better and allows filtering messages by
command.

Discussion: https://www.postgresql.org/message-id/ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.com

src/bin/pg_dump/t/003_pg_dump_with_server.pl
src/common/logging.c

index a0b23aae0fb6c9ba7c907f7721e02fc92f1a176d..8cc9da06599100ddcf8db49e4a451d6c01f2de6c 100644 (file)
@@ -30,7 +30,7 @@ my ($cmd, $stdout, $stderr, $result);
 
 command_fails_like(
    [ "pg_dump", '-p', $port, '--include-foreign-data=s0', 'postgres' ],
-   qr/foreign-data wrapper \"dummy\" has no handler\r?\ndetail: Query was: .*t0/,
+   qr/foreign-data wrapper \"dummy\" has no handler\r?\npg_dump: detail: Query was: .*t0/,
    "correctly fails to dump a foreign table from a dummy FDW");
 
 command_ok(
index 0b5bcb1a17256948a727f92a072fc1448d1b85f4..64604c520963c0c2186864ccf40c2e2fb1ab4508 100644 (file)
@@ -246,8 +246,7 @@ pg_log_generic_v(enum pg_log_level level, enum pg_log_part part,
 
    fmt = _(fmt);
 
-   if (part == PG_LOG_PRIMARY &&
-       (!(log_flags & PG_LOG_FLAG_TERSE) || filename))
+   if (!(log_flags & PG_LOG_FLAG_TERSE) || filename)
    {
        if (sgr_locus)
            fprintf(stderr, ANSI_ESCAPE_FMT, sgr_locus);