Improve frontend error logging style.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 8 Apr 2022 18:55:14 +0000 (14:55 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 8 Apr 2022 18:55:14 +0000 (14:55 -0400)
commit9a374b77fb53e4cfbca121e4fa278a7d71bde7c4
tree6591af757bd9df12549279b4b87f01e0ce98bd79
parent5c431c7fb327e1abc70b7a197650f8d45fd5bede
Improve frontend error logging style.

Get rid of the separate "FATAL" log level, as it was applied
so inconsistently as to be meaningless.  This mostly involves
s/pg_log_fatal/pg_log_error/g.

Create a macro pg_fatal() to handle the common use-case of
pg_log_error() immediately followed by exit(1).  Various
modules had already invented either this or equivalent macros;
standardize on pg_fatal() and apply it where possible.

Invent the ability to add "detail" and "hint" messages to a
frontend message, much as we have long had in the backend.

Except where rewording was needed to convert existing coding
to detail/hint style, I have (mostly) resisted the temptation
to change existing message wording.

Patch by me.  Design and patch reviewed at various stages by
Robert Haas, Kyotaro Horiguchi, Peter Eisentraut and
Daniel Gustafsson.

Discussion: https://postgr.es/m/1363732.1636496441@sss.pgh.pa.us
77 files changed:
contrib/oid2name/oid2name.c
contrib/vacuumlo/vacuumlo.c
src/bin/initdb/initdb.c
src/bin/pg_amcheck/pg_amcheck.c
src/bin/pg_archivecleanup/pg_archivecleanup.c
src/bin/pg_basebackup/bbstreamer_file.c
src/bin/pg_basebackup/bbstreamer_gzip.c
src/bin/pg_basebackup/bbstreamer_inject.c
src/bin/pg_basebackup/bbstreamer_lz4.c
src/bin/pg_basebackup/bbstreamer_tar.c
src/bin/pg_basebackup/bbstreamer_zstd.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/pg_recvlogical.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/streamutil.c
src/bin/pg_basebackup/walmethods.c
src/bin/pg_checksums/pg_checksums.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_dump/common.c
src/bin/pg_dump/compress_io.c
src/bin/pg_dump/nls.mk
src/bin/pg_dump/parallel.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_directory.c
src/bin/pg_dump/pg_backup_null.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_utils.c
src/bin/pg_dump/pg_backup_utils.h
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump_sort.c
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/t/003_pg_dump_with_server.pl
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_rewind/nls.mk
src/bin/pg_rewind/pg_rewind.c
src/bin/pg_rewind/pg_rewind.h
src/bin/pg_rewind/t/009_growing_files.pl
src/bin/pg_rewind/timeline.c
src/bin/pg_test_fsync/pg_test_fsync.c
src/bin/pg_upgrade/pg_upgrade.h
src/bin/pg_verifybackup/pg_verifybackup.c
src/bin/pg_verifybackup/t/005_bad_manifest.pl
src/bin/pg_waldump/nls.mk
src/bin/pg_waldump/pg_waldump.c
src/bin/pgbench/pgbench.c
src/bin/psql/command.c
src/bin/psql/common.c
src/bin/psql/help.c
src/bin/psql/mainloop.c
src/bin/psql/startup.c
src/bin/psql/t/001_basic.pl
src/bin/scripts/clusterdb.c
src/bin/scripts/createdb.c
src/bin/scripts/createuser.c
src/bin/scripts/dropdb.c
src/bin/scripts/dropuser.c
src/bin/scripts/pg_isready.c
src/bin/scripts/reindexdb.c
src/bin/scripts/vacuumdb.c
src/common/controldata_utils.c
src/common/file_utils.c
src/common/logging.c
src/common/restricted_token.c
src/fe_utils/archive.c
src/fe_utils/connect_utils.c
src/fe_utils/parallel_slot.c
src/fe_utils/query_utils.c
src/fe_utils/recovery_gen.c
src/include/common/logging.h
src/include/lib/simplehash.h
src/nls-global.mk