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

Commit09c1baa

Browse files
committed
Move code that places LOG error level between ERROR and PANIC into new
function is_log_level_output(), for code clarity.
1 parent92b8d17 commit09c1baa

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

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

Lines changed: 29 additions & 26 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.179 2007/01/05 22:19:43 momjian Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.180 2007/01/20 14:45:35 momjian Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -121,6 +121,7 @@ static char *expand_fmt_string(const char *fmt, ErrorData *edata);
121121
staticconstchar*useful_strerror(interrnum);
122122
staticconstchar*error_severity(intelevel);
123123
staticvoidappend_with_tabs(StringInfobuf,constchar*str);
124+
staticintis_log_level_output(intelevel,intlog_min_level);
124125

125126

126127
/*
@@ -139,7 +140,7 @@ errstart(int elevel, const char *filename, int lineno,
139140
constchar*funcname)
140141
{
141142
ErrorData*edata;
142-
booloutput_to_server= false;
143+
booloutput_to_server;
143144
booloutput_to_client= false;
144145
inti;
145146

@@ -196,33 +197,10 @@ errstart(int elevel, const char *filename, int lineno,
196197

197198
/* Determine whether message is enabled for server log output */
198199
if (IsPostmasterEnvironment)
199-
{
200-
/* Complicated because LOG is sorted out-of-order for this purpose */
201-
if (elevel==LOG||elevel==COMMERROR)
202-
{
203-
if (log_min_messages==LOG)
204-
output_to_server= true;
205-
elseif (log_min_messages<FATAL)
206-
output_to_server= true;
207-
}
208-
else
209-
{
210-
/* elevel != LOG */
211-
if (log_min_messages==LOG)
212-
{
213-
if (elevel >=FATAL)
214-
output_to_server= true;
215-
}
216-
/* Neither is LOG */
217-
elseif (elevel >=log_min_messages)
218-
output_to_server= true;
219-
}
220-
}
200+
output_to_server=is_log_level_output(elevel,log_min_messages);
221201
else
222-
{
223202
/* In bootstrap/standalone case, do not sort LOG out-of-order */
224203
output_to_server= (elevel >=log_min_messages);
225-
}
226204

227205
/* Determine whether message is enabled for client output */
228206
if (whereToSendOutput==DestRemote&&elevel!=COMMERROR)
@@ -2073,3 +2051,28 @@ write_stderr(const char *fmt,...)
20732051
#endif
20742052
va_end(ap);
20752053
}
2054+
2055+
2056+
staticintis_log_level_output(intelevel,intlog_min_level)
2057+
{
2058+
/*
2059+
*Complicated because LOG is sorted out-of-order here, between
2060+
*ERROR and FATAL.
2061+
*/
2062+
if (elevel==LOG||elevel==COMMERROR)
2063+
{
2064+
if (log_min_level==LOG||log_min_level <=ERROR)
2065+
return true;
2066+
}
2067+
elseif (log_min_level==LOG)
2068+
{
2069+
/* elevel != LOG */
2070+
if (elevel >=FATAL)
2071+
return true;
2072+
}
2073+
/* Neither is LOG */
2074+
elseif (elevel >=log_min_level)
2075+
return true;
2076+
2077+
return false;
2078+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp