On Fri, Mar 25, 2016 at 12:55 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paqu...@gmail.com> writes:
>> Not sure if Andres is working on that for now or not, the main
>> discussion that I am foreseeing here is how we are going to map elevel
>> for the frontend (should FATAL, PANIC exit immediately, etc).
>
> Doesn't seem that complicated to me: elevel >= ERROR results in exit(1),
> otherwise just print to stderr and return.  We'd be eyeballing each case
> that we remove "#ifndef FRONTEND" from anyway; if it's expecting behavior
> noticeably more complicated than that, we could leave it as-is.

Something that I see as mandatory as well is a way to bypass some of
the elevels depending on the way a frontend tool is called, so we'd
need something like that in the common elog facility:

void
elog(blah)
{
#ifdef FRONTEND
     if (!callback_routine_defined_in_frontend(elevel))
         return;
#endif

     blah_blah_move_on.
}

This would be useful to avoid code patterns of this type in a frontend
tool where for example a debug flag is linked with elevel. For example
this pattern:
if (debug)
    elog(DEBUG1, "Debug blah");
could be reduced to as the callback routine would allow bypassing
elog() directly:
elog(DEBUG1, "Debug blah");

That's just food for thought at this stage, I get back to reviewing...
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to