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

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: Log prefix missing for subscriber log messages received from publisher
Дата
Msg-id 33f8b25d-1ea4-4377-ab8c-c29a9eb02122@oss.nttdata.com
обсуждение исходный текст
Ответ на Re: Log prefix missing for subscriber log messages received from publisher  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Ответы Re: Log prefix missing for subscriber log messages received from publisher
Список pgsql-hackers

On 2025/07/17 23:34, Fujii Masao wrote:
>> The attached v5 version patch
>> has the changes for the same.
> 
> Thanks for updating the patches!

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?

--------------------
static inline void
libpqsrv_notice_receiver(void *arg, const PGresult *res)
{
    char       *message;
    int            len;
    char       *prefix = (char *) arg;

    /*
     * Trim the trailing newline from the message text returned from
     * PQresultErrorMessage(), as it always includes one, to produce
     * cleaner log output.
     */
    message = PQresultErrorMessage(res);
    len = strlen(message);
    if (len > 0 && message[len - 1] == '\n')
        len--;

    ereport(LOG,
            errmsg("received message %s: %.*s", prefix, len, message));
}
--------------------

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation




В списке pgsql-hackers по дате отправления: