From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: velog + vereport? |
Date: | 2012-10-12 13:09:28 |
Message-ID: | 201210121509.29020.andres@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Friday, October 12, 2012 02:48:42 PM Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > When writing code which should be able to run inside and outside a normal
> > backend environment its sometimes useful to be able add a wrapper arround
> > elog/ereport for when executing inside the backend.
> > Currently that requires relatively ugly macro surgery and/or recompiling
> > the file. I suggest adding velog/vereport or elog_va/vereport_va to make
> > such wrappers easier (still not easy though).
>
> Um ... and that accomplishes what? You wouldn't have velog/vereport
> outside the backend either. If you were going to clone those in some
> form in the external environment, you might as well clone the existing
> elog infrastructure functions.
The advantage is that if you something velog-ish you can have a function which
accepts vararg arguments and forwards them.
E.g.
xlogreader->error(ERROR, "...", argument, argument);
Which is a callback using vfprintf(stderr) if running standalone or a callback
calling vereport().
(obviously you need some more magick to also forward file/line/function, but
its not too hard)
Greetings,
Andres
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-10-12 14:59:39 | Re: velog + vereport? |
Previous Message | Tom Lane | 2012-10-12 12:48:42 | Re: velog + vereport? |