Re: Unified logging system for command-line programs
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-03T13:15:43Z
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
Commits
-
Unified logging system for command-line programs
- cc8d41511721 12.0 landed
-
Assorted translatable string fixes
- 55a70a023c3d 10.0 cited