pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Unified logging system for command-line programs
Date: Thu, 3 Jan 2019 14:15:43 +0100
Message-ID: <eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com> (raw)
In-Reply-To: <21141.1546199123@sss.pgh.pa.us>
References: <6a609b43-4f57-7348-6480-bd022f924310@2ndquadrant.com>
	<21141.1546199123@sss.pgh.pa.us>

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




view thread (27+ messages)  latest in thread

Message-ID: <eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com>
Permalink:  ../eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com/
Also on:    postgresql.org/message-id/eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us
  Subject: Re: Unified logging system for command-line programs
  In-Reply-To: <eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox