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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove not-very-useful early checks of __pg_log_level in logging
Date: 2022-04-12 17:25:36
Message-ID: E1neKGm-000CSU-92@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2022-04-12 19:12:34 pgsql: Revert the addition of GetMaxBackends() and related stuff.
Previous Message Tom Lane 2022-04-12 15:36:59 pgsql: Doc: update description of random() function.