public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pavel Stehule <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Re: PoC - psql - emphases line with table name in verbose output
Date: Tue, 14 Apr 2026 05:42:24 +0200
Message-ID: <CAFj8pRDarWO-OsR+u0dWs=Y6aVOc+ebb_PJH8CdUuwmdOmR4tA@mail.gmail.com> (raw)
In-Reply-To: <CAFj8pRD2MOak45s8=bex3BcncJf2jt9ukx=i9pKmWB1SepZu6g@mail.gmail.com>
References: <CAFj8pRD2MOak45s8=bex3BcncJf2jt9ukx=i9pKmWB1SepZu6g@mail.gmail.com>
Hi
rebase, new commit message and minor cleaning
Regards
Pavel
Attachments:
[text/x-patch] v20260414-1-0001-Print-opening-INFO-lines-with-coulours.patch (2.3K, 3-v20260414-1-0001-Print-opening-INFO-lines-with-coulours.patch)
download | inline diff:
From 37bd1aa00fea7c7d88c81bea15694212e99b4e52 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Sun, 29 Mar 2026 18:01:16 +0200
Subject: [PATCH] Print opening INFO lines with coulours
By default it use inverse printing for lines:
INFO: vacuuming tablename
INFO: repacking tablename
INFO: analyzing tablename
It helps with orientation inside verbose output of REINDEX, VACUUM and ANALYZE commands.
---
src/common/logging.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/common/logging.c b/src/common/logging.c
index 4a69d96281b..3e5e9eea6e8 100644
--- a/src/common/logging.c
+++ b/src/common/logging.c
@@ -32,11 +32,13 @@ static const char *sgr_error = NULL;
static const char *sgr_warning = NULL;
static const char *sgr_note = NULL;
static const char *sgr_locus = NULL;
+static const char *sgr_info_command = NULL;
#define SGR_ERROR_DEFAULT "01;31"
#define SGR_WARNING_DEFAULT "01;35"
#define SGR_NOTE_DEFAULT "01;36"
#define SGR_LOCUS_DEFAULT "01"
+#define SGR_INFO_COMMAND_DEFAULT "07"
#define ANSI_ESCAPE_FMT "\x1b[%sm"
#define ANSI_ESCAPE_RESET "\x1b[0m"
@@ -145,6 +147,8 @@ pg_logging_init(const char *argv0)
sgr_note = strdup(value);
if (strcmp(name, "locus") == 0)
sgr_locus = strdup(value);
+ if (strcmp(name, "info_command") == 0)
+ sgr_info_command = strdup(value);
}
}
@@ -157,6 +161,7 @@ pg_logging_init(const char *argv0)
sgr_warning = SGR_WARNING_DEFAULT;
sgr_note = SGR_NOTE_DEFAULT;
sgr_locus = SGR_LOCUS_DEFAULT;
+ sgr_info_command = SGR_INFO_COMMAND_DEFAULT;
}
}
}
@@ -353,7 +358,17 @@ pg_log_generic_v(enum pg_log_level level, enum pg_log_part part,
if (required_len >= 2 && buf[required_len - 2] == '\n')
buf[required_len - 2] = '\0';
- fprintf(stderr, "%s\n", buf);
+ if (level == PG_LOG_INFO && sgr_info_command &&
+ (strncmp(buf, "INFO: vacuuming", strlen("INFO: vacuuming")) == 0 ||
+ strncmp(buf, "INFO: repacking", strlen("INFO: repacking")) == 0 ||
+ strncmp(buf, "INFO: analyzing", strlen("INFO: analyzing")) == 0))
+ {
+ fprintf(stderr, ANSI_ESCAPE_FMT, sgr_info_command);
+ fprintf(stderr, "%s\n", buf);
+ fprintf(stderr, ANSI_ESCAPE_RESET);
+ }
+ else
+ fprintf(stderr, "%s\n", buf);
if (log_logfile)
{
fprintf(log_logfile, "%s\n", buf);
--
2.53.0
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: PoC - psql - emphases line with table name in verbose output
In-Reply-To: <CAFj8pRDarWO-OsR+u0dWs=Y6aVOc+ebb_PJH8CdUuwmdOmR4tA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox