Commit 74ffc772 authored by Tom Lane's avatar Tom Lane

Code review for log_line_prefix patch. Cooperate with StringInfo instead

of fighting it, avoid hard-wired (and wrong) assumption about max length
of prefix, cause %l to actually work as documented, don't compute data
we may not need.
parent 87265917
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* to contain some useful information. Mechanism differs wildly across * to contain some useful information. Mechanism differs wildly across
* platforms. * platforms.
* *
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.18 2004/03/09 04:43:07 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.19 2004/03/19 02:23:59 tgl Exp $
* *
* Copyright (c) 2000-2003, PostgreSQL Global Development Group * Copyright (c) 2000-2003, PostgreSQL Global Development Group
* various details abducted from various places * various details abducted from various places
...@@ -277,15 +277,14 @@ init_ps_display(const char *username, const char *dbname, ...@@ -277,15 +277,14 @@ init_ps_display(const char *username, const char *dbname,
void void
set_ps_display(const char *activity) set_ps_display(const char *activity)
{ {
/* no ps display for stand-alone backend */ /* save tag for possible use by elog.c */
if (!IsUnderPostmaster)
return;
/* save it for logging context */
if (MyProcPort) if (MyProcPort)
MyProcPort->commandTag = (char *) activity; MyProcPort->commandTag = activity;
#ifndef PS_USE_NONE #ifndef PS_USE_NONE
/* no ps display for stand-alone backend */
if (!IsUnderPostmaster)
return;
#ifdef PS_USE_CLOBBER_ARGV #ifdef PS_USE_CLOBBER_ARGV
/* If ps_buffer is a pointer, it might still be null */ /* If ps_buffer is a pointer, it might still be null */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.42 2004/03/09 04:43:07 momjian Exp $ * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.43 2004/03/19 02:23:59 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -50,8 +50,6 @@ typedef struct Port ...@@ -50,8 +50,6 @@ typedef struct Port
SockAddr raddr; /* remote addr (client) */ SockAddr raddr; /* remote addr (client) */
char *remote_host; /* name (or ip addr) of remote host */ char *remote_host; /* name (or ip addr) of remote host */
char *remote_port; /* text rep of remote port */ char *remote_port; /* text rep of remote port */
char *commandTag; /* command tag for display in log lines */
struct timeval session_start; /* for session duration logging */
CAC_state canAcceptConnections; /* postmaster connection status */ CAC_state canAcceptConnections; /* postmaster connection status */
/* /*
...@@ -73,6 +71,14 @@ typedef struct Port ...@@ -73,6 +71,14 @@ typedef struct Port
char md5Salt[4]; /* Password salt */ char md5Salt[4]; /* Password salt */
char cryptSalt[2]; /* Password salt */ char cryptSalt[2]; /* Password salt */
/*
* Information that really has no business at all being in struct Port,
* but since it gets used by elog.c in the same way as database_name
* and other members of this struct, we may as well keep it here.
*/
const char *commandTag; /* current command tag */
struct timeval session_start; /* for session duration logging */
/* /*
* SSL structures * SSL structures
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment