Re: Unified logging system for command-line programs

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unified logging system for command-line programs
Date: 2019-01-03 13:15:43
Message-ID: eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/12/2018 20:45, Tom Lane wrote:
> It seems like a shame that src/common files still need to have
> #ifdef FRONTEND variant code to deal with frontend vs. backend
> conventions. I wonder how hard it would be to layer some subset of
> ereport() functionality on top of what you have here, so as to get
> rid of those #ifdef stanzas.

The patch does address that in some places:

@@ -39,12 +45,7 @@ pgfnames(const char *path)
dir = opendir(path);
if (dir == NULL)
{
-#ifndef FRONTEND
- elog(WARNING, "could not open directory \"%s\": %m", path);
-#else
- fprintf(stderr, _("could not open directory \"%s\": %s\n"),
- path, strerror(errno));
-#endif
+ pg_log_warning("could not open directory \"%s\": %m", path);
return NULL;
}

It's worth noting that less than 5 files are of concern for this, so
creating a more elaborate system would probably be more code than you'd
save at the other end.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-03 13:28:51 Re: Unified logging system for command-line programs
Previous Message David Rowley 2019-01-03 12:39:26 Re: "SELECT ... FROM DUAL" is not quite as silly as it appears