Re: Unified logging system for command-line programs

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Unified logging system for command-line programs
Дата
Msg-id eb4b0fce-01a2-02d8-c1b2-ae4e61c3a0d7@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Unified logging system for command-line programs  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: "SELECT ... FROM DUAL" is not quite as silly as it appears
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Unified logging system for command-line programs