Applied patch attached that moves code that places LOG error level
between ERROR and PANIC into new function is_log_level_output(), for
code clarity.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.179
diff -c -c -r1.179 elog.c
*** src/backend/utils/error/elog.c	5 Jan 2007 22:19:43 -0000	1.179
--- src/backend/utils/error/elog.c	20 Jan 2007 14:34:25 -0000
***************
*** 121,126 ****
--- 121,127 ----
  static const char *useful_strerror(int errnum);
  static const char *error_severity(int elevel);
  static void append_with_tabs(StringInfo buf, const char *str);
+ static int is_log_level_output(int elevel, int log_min_level);
  
  
  /*
***************
*** 139,145 ****
  		 const char *funcname)
  {
  	ErrorData  *edata;
! 	bool		output_to_server = false;
  	bool		output_to_client = false;
  	int			i;
  
--- 140,146 ----
  		 const char *funcname)
  {
  	ErrorData  *edata;
! 	bool		output_to_server;
  	bool		output_to_client = false;
  	int			i;
  
***************
*** 196,228 ****
  
  	/* Determine whether message is enabled for server log output */
  	if (IsPostmasterEnvironment)
! 	{
! 		/* Complicated because LOG is sorted out-of-order for this purpose */
! 		if (elevel == LOG || elevel == COMMERROR)
! 		{
! 			if (log_min_messages == LOG)
! 				output_to_server = true;
! 			else if (log_min_messages < FATAL)
! 				output_to_server = true;
! 		}
! 		else
! 		{
! 			/* elevel != LOG */
! 			if (log_min_messages == LOG)
! 			{
! 				if (elevel >= FATAL)
! 					output_to_server = true;
! 			}
! 			/* Neither is LOG */
! 			else if (elevel >= log_min_messages)
! 				output_to_server = true;
! 		}
! 	}
  	else
- 	{
  		/* In bootstrap/standalone case, do not sort LOG out-of-order */
  		output_to_server = (elevel >= log_min_messages);
- 	}
  
  	/* Determine whether message is enabled for client output */
  	if (whereToSendOutput == DestRemote && elevel != COMMERROR)
--- 197,206 ----
  
  	/* Determine whether message is enabled for server log output */
  	if (IsPostmasterEnvironment)
! 		output_to_server = is_log_level_output(elevel, log_min_messages);
  	else
  		/* In bootstrap/standalone case, do not sort LOG out-of-order */
  		output_to_server = (elevel >= log_min_messages);
  
  	/* Determine whether message is enabled for client output */
  	if (whereToSendOutput == DestRemote && elevel != COMMERROR)
***************
*** 2073,2075 ****
--- 2051,2078 ----
  #endif
  	va_end(ap);
  }
+ 
+ 
+ static int is_log_level_output(int elevel, int log_min_level)
+ {
+ 	/*
+ 	 *	Complicated because LOG is sorted out-of-order here, between
+ 	 *	ERROR and FATAL.
+ 	 */
+ 	if (elevel == LOG || elevel == COMMERROR)
+ 	{
+ 		if (log_min_level == LOG || log_min_level <= ERROR)
+ 			return true;
+ 	}
+ 	else if (log_min_level == LOG)
+ 	{
+ 		/* elevel != LOG */
+ 		if (elevel >= FATAL)
+ 			return true;
+ 	}
+ 	/* Neither is LOG */
+ 	else if (elevel >= log_min_level)
+ 		return true;
+ 
+ 	return false;
+ }
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to