Re: Frontend error logging style
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>, Andres Freund <andres@anarazel.de>,
Robert Haas <robertmhaas@gmail.com>, Michael Paquier <michael@paquier.xyz>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-04-12T18:29:34Z
Lists: pgsql-hackers
On 11.04.22 17:22, Tom Lane wrote: > Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes: >> On 08.04.22 22:26, Tom Lane wrote: >>>> I think we should put a centralized level check >>>> into logging.c, and get rid of at least the "if (likely())" >>>> checks, because those are going to succeed approximately 100.0% >>>> of the time. Maybe there's an argument for keeping the unlikely() >>>> ones. > >> Yeah, that seems ok to change. The previous coding style is more useful >> if you have a lot of debug messages in a hot code path, but that usually >> doesn't apply to where this is used. > > The patch I presented keeps the unlikely() checks in the debug-level > macros. Do you think we should drop those too? I figured that avoiding > evaluating the arguments would be worth something. Oh, that's right, the whole thing is to not evaluate the arguments if the log level isn't adequate. We should probably keep that. Is the code size a big problem? ereport() has a bunch of extra code around each call as well. Does it have similar problems?
Commits
-
logging: Also add the command prefix to detail and hint messages
- a8cca6026e99 15.0 landed
-
Remove not-very-useful early checks of __pg_log_level in logging.h.
- 2c9381840fe2 15.0 landed
-
Improve frontend error logging style.
- 9a374b77fb53 15.0 landed
-
Apply PGDLLIMPORT markings broadly.
- 8ec569479fc2 15.0 cited