pgsql: Remove not-very-useful early checks of __pg_log_level in logging - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove not-very-useful early checks of __pg_log_level in logging
Date
Msg-id E1neKGm-000CSU-92@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove not-very-useful early checks of __pg_log_level in logging.h.

Enforce __pg_log_level message filtering centrally in logging.c,
instead of relying on the calling macros to do it.  This is more
reliable (e.g. it works correctly for direct calls to pg_log_generic)
and it saves a percent or so of total code size because we get rid of
so many duplicate checks of __pg_log_level.

This does mean that argument expressions in a logging macro will be
evaluated even if we end up not printing anything.  That seems of
little concern for INFO and higher levels as those messages are printed
by default, and most of our frontend programs don't even offer a way to
turn them off.  I left the unlikely() checks in place for DEBUG
messages, though.

Discussion: https://postgr.es/m/3993549.1649449609@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2c9381840fe2d6d1c3179350493fe5fd3dcf90b5

Modified Files
--------------
src/bin/pg_dump/pg_backup_utils.h |  3 +--
src/common/logging.c              |  4 +++
src/include/common/logging.h      | 57 +++++++++++++--------------------------
3 files changed, 24 insertions(+), 40 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: update description of random() function.
Next
From: Robert Haas
Date:
Subject: pgsql: Revert the addition of GetMaxBackends() and related stuff.