Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit111e29e

Browse files
committed
Adjust comment about %t and %s to cover %m as well. Some trivial
code beautification too.
1 parentb4cbd60 commit111e29e

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

‎src/backend/utils/error/elog.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.160 2005/06/1016:23:10 neilc Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/1020:48:54 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1333,10 +1333,7 @@ log_line_prefix(StringInfo buf)
13331333
/* go to char after '%' */
13341334
i++;
13351335
if (i >=format_len)
1336-
{
1337-
/* format error - ignore it */
1338-
break;
1339-
}
1336+
break;/* format error - ignore it */
13401337

13411338
/* process the option */
13421339
switch (Log_line_prefix[i])
@@ -1377,8 +1374,18 @@ log_line_prefix(StringInfo buf)
13771374
break;
13781375
case'm':
13791376
{
1377+
/*
1378+
* Note: for %m, %t, and %s we deliberately use the
1379+
* C library's strftime/localtime, and not the
1380+
* equivalent functions from src/timezone.This
1381+
* ensures that all backends will report log entries
1382+
* in the same timezone, namely whatever C-library
1383+
* setting they inherit from the postmaster. If we
1384+
* used src/timezone then local settings of the
1385+
* TimeZone GUC variable would confuse the log.
1386+
*/
13801387
time_tstamp_time;
1381-
charstrfbuf[128],msbuf[5];
1388+
charstrfbuf[128],msbuf[8];
13821389
structtimevaltv;
13831390

13841391
gettimeofday(&tv,NULL);
@@ -1388,32 +1395,21 @@ log_line_prefix(StringInfo buf)
13881395
/* leave room for milliseconds... */
13891396
/* Win32 timezone names are too long so don't print them. */
13901397
#ifndefWIN32
1391-
"%Y-%m-%d %H:%M:%S %Z",
1398+
"%Y-%m-%d %H:%M:%S %Z",
13921399
#else
1393-
"%Y-%m-%d %H:%M:%S ",
1400+
"%Y-%m-%d %H:%M:%S ",
13941401
#endif
1395-
localtime(&stamp_time));
1402+
localtime(&stamp_time));
13961403

13971404
/* 'paste' milliseconds into place... */
1398-
sprintf(msbuf,".%03d",
1399-
(int)(tv.tv_usec/1000));
1405+
sprintf(msbuf,".%03d", (int) (tv.tv_usec/1000));
14001406
strncpy(strfbuf+19,msbuf,4);
14011407

14021408
appendStringInfoString(buf,strfbuf);
14031409
}
14041410
break;
14051411
case't':
14061412
{
1407-
/*
1408-
* Note: for %t and %s we deliberately use the C
1409-
* library's strftime/localtime, and not the
1410-
* equivalent functions from src/timezone.This
1411-
* ensures that all backends will report log entries
1412-
* in the same timezone, namely whatever C-library
1413-
* setting they inherit from the postmaster. If we
1414-
* used src/timezone then local settings of the
1415-
* TimeZone GUC variable would confuse the log.
1416-
*/
14171413
time_tstamp_time=time(NULL);
14181414
charstrfbuf[128];
14191415

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp