Re: [Proposal] Adding Log File Capability to pg_createsubscriber

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com>
Cc: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Date: 2026-03-18 13:15:17
Message-ID: CAA4eK1K1GLKiuFmcpcKJzhS-o2o2-aKEuaGWmHz-MfJhttaKFg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 18, 2026 at 4:55 AM Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com> wrote:
>
> Thanks a lot, Shlok, for all the changes. I have included the changes from topup.patch to my changes.
>

+#undef pg_log_warning
+#define pg_log_warning(...) \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_WARNING, __VA_ARGS__); \
+ pg_log_generic(PG_LOG_WARNING, PG_LOG_PRIMARY, __VA_ARGS__)
+
+#undef pg_log_warning_detail
+#define pg_log_warning_detail(...) \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_WARNING, __VA_ARGS__); \
+ pg_log_generic(PG_LOG_WARNING, PG_LOG_DETAIL, __VA_ARGS__)
+
+#undef pg_log_warning_hint
+#define pg_log_warning_hint(...) \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_WARNING, __VA_ARGS__); \
+ pg_log_generic(PG_LOG_WARNING, PG_LOG_HINT, __VA_ARGS__)
+
+#undef pg_log_info
+#define pg_log_info(...) do { \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_INFO, __VA_ARGS__); \
+ else \
+ pg_log_generic(PG_LOG_INFO, PG_LOG_PRIMARY, __VA_ARGS__); \
+} while(0)
+
+#undef pg_log_info_hint
+#define pg_log_info_hint(...) do { \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_INFO, __VA_ARGS__); \
+ else \
+ pg_log_generic(PG_LOG_INFO, PG_LOG_HINT, __VA_ARGS__); \
+} while(0)
+
+#undef pg_log_debug
+#define pg_log_debug(...) do { \
+ if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) { \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_DEBUG, __VA_ARGS__); \
+ else \
+ pg_log_generic(PG_LOG_DEBUG, PG_LOG_PRIMARY, __VA_ARGS__); \
+ } \
+} while(0)
+
+#undef pg_fatal
+#define pg_fatal(...) do { \
+ if (internal_log_file_fp != NULL) \
+ internal_log_file_write(PG_LOG_ERROR, __VA_ARGS__); \
+ pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__); \
+ exit(1); \
+} while(0)

This looks odd to me. I think it would be better to encapsulate this
in one function (something like we have in pg_log_v) and then based on
log level, do required handling.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2026-03-18 13:15:40 Re: SQL Property Graph Queries (SQL/PGQ)
Previous Message Jacob Champion 2026-03-18 13:01:45 Re: Serverside SNI support in libpq