Re: Unified logging system for command-line programs - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Unified logging system for command-line programs
Date
Msg-id eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com
Whole thread Raw
In response to Re: Unified logging system for command-line programs  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: "SELECT ... FROM DUAL" is not quite as silly as it appears
Next
From: Peter Eisentraut
Date:
Subject: Re: Unified logging system for command-line programs