Re: Log prefix missing for subscriber log messages received from publisher

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Fujii Masao <masao.fujii@gmail.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-18T17:06:15Z
Lists: pgsql-hackers

Attachments

On Fri, 18 Jul 2025 at 04:46, Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>
>
>
> On 2025/07/18 1:15, Álvaro Herrera wrote:
> > On 2025-Jul-18, Fujii Masao wrote:
> >
> >> The current patches add nearly identical notice_receiver functions
> >> in multiple places such as libpqwalreceiver.c and elsewhere. To avoid
> >> duplicating the same logic, could we define a shared notice receiver
> >> function in a common file, like libpq-be-fe-helpers.h, and use it in
> >> all three locations?
> >
> > I like the idea of reducing duplication.  I don't like the "prefix"
> > as proposed though, because it's not going to work well for translation
> > (string building) -- I'd rather pass the entire phrase from caller, so
> > that the translator has one piece to translate which lives in the module
> > that emits it.  I think I'd do something like
> >
> >      ereport(LOG,
> >              errmsg_internal("%s: %.*s",
> >                           _(prefix), len, message));
> >
> > and see to it that each caller uses gettext_noop() around the string
> > they pass as "arg", for gettext to collect.
>
> Agreed. Thanks!

The attached v6 version patch has the changes for these comments.

Regards,
Vignesh

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove translation marker from libpq-be-fe-helpers.h.

  2. Log remote NOTICE, WARNING, and similar messages using ereport().

  3. Remove translation markers from libpq-be-fe-helpers.h