Emitting each variable separately is unnecessarily verbose / hard to skim
over. Emit the whole thing in one ereport() to address that.
Also remove program name and function reference from the message. The former
doesn't seem particularly helpful and the latter is provided by the elog.c
infrastructure these days.
Reviewed-by: Heikki Linnakangas
Reviewed-by: Peter Eisentraut
Discussion: https://postgr.es/m/leouteo5ozcrux3fepuhtbp6c56tbfd4naxeokidbx7m75cabz@hhw6g4urlowt
#endif
/* For debugging: display postmaster environment */
+ if (message_level_is_interesting(DEBUG3))
{
extern char **environ;
char **p;
+ StringInfoData si;
- ereport(DEBUG3,
- (errmsg_internal("%s: PostmasterMain: initial environment dump:",
- progname)));
- ereport(DEBUG3,
- (errmsg_internal("-----------------------------------------")));
+ initStringInfo(&si);
+
+ appendStringInfoString(&si, "initial environment dump:");
for (p = environ; *p; ++p)
- ereport(DEBUG3,
- (errmsg_internal("\t%s", *p)));
- ereport(DEBUG3,
- (errmsg_internal("-----------------------------------------")));
+ appendStringInfo(&si, "\n%s", *p);
+
+ ereport(DEBUG3, errmsg_internal("%s", si.data));
+ pfree(si.data);
}
/*