Adjust comment about %t and %s to cover %m as well. Some trivial
code beautification too.
This commit is contained in:
parent
b4cbd60fcf
commit
111e29ef5e
@ -42,7 +42,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.160 2005/06/10 16:23:10 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/10 20:48:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1333,10 +1333,7 @@ log_line_prefix(StringInfo buf)
|
|||||||
/* go to char after '%' */
|
/* go to char after '%' */
|
||||||
i++;
|
i++;
|
||||||
if (i >= format_len)
|
if (i >= format_len)
|
||||||
{
|
break; /* format error - ignore it */
|
||||||
/* format error - ignore it */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* process the option */
|
/* process the option */
|
||||||
switch (Log_line_prefix[i])
|
switch (Log_line_prefix[i])
|
||||||
@ -1377,8 +1374,18 @@ log_line_prefix(StringInfo buf)
|
|||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Note: for %m, %t, and %s we deliberately use the
|
||||||
|
* C library's strftime/localtime, and not the
|
||||||
|
* equivalent functions from src/timezone. This
|
||||||
|
* ensures that all backends will report log entries
|
||||||
|
* in the same timezone, namely whatever C-library
|
||||||
|
* setting they inherit from the postmaster. If we
|
||||||
|
* used src/timezone then local settings of the
|
||||||
|
* TimeZone GUC variable would confuse the log.
|
||||||
|
*/
|
||||||
time_t stamp_time;
|
time_t stamp_time;
|
||||||
char strfbuf[128], msbuf[5];
|
char strfbuf[128], msbuf[8];
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
@ -1395,8 +1402,7 @@ log_line_prefix(StringInfo buf)
|
|||||||
localtime(&stamp_time));
|
localtime(&stamp_time));
|
||||||
|
|
||||||
/* 'paste' milliseconds into place... */
|
/* 'paste' milliseconds into place... */
|
||||||
sprintf(msbuf, ".%03d",
|
sprintf(msbuf, ".%03d", (int) (tv.tv_usec/1000));
|
||||||
(int)(tv.tv_usec/1000));
|
|
||||||
strncpy(strfbuf+19, msbuf, 4);
|
strncpy(strfbuf+19, msbuf, 4);
|
||||||
|
|
||||||
appendStringInfoString(buf, strfbuf);
|
appendStringInfoString(buf, strfbuf);
|
||||||
@ -1404,16 +1410,6 @@ log_line_prefix(StringInfo buf)
|
|||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Note: for %t and %s we deliberately use the C
|
|
||||||
* library's strftime/localtime, and not the
|
|
||||||
* equivalent functions from src/timezone. This
|
|
||||||
* ensures that all backends will report log entries
|
|
||||||
* in the same timezone, namely whatever C-library
|
|
||||||
* setting they inherit from the postmaster. If we
|
|
||||||
* used src/timezone then local settings of the
|
|
||||||
* TimeZone GUC variable would confuse the log.
|
|
||||||
*/
|
|
||||||
time_t stamp_time = time(NULL);
|
time_t stamp_time = time(NULL);
|
||||||
char strfbuf[128];
|
char strfbuf[128];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user