From 92288a1cf9490be3835dc8524ee2ba407f1b885a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 6 Mar 2002 06:10:59 +0000 Subject: Change made to elog: o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed. --- src/pl/plpgsql/src/pl_comp.c | 4 ++-- src/pl/plpgsql/src/pl_exec.c | 18 +++++++++--------- src/pl/plpython/plpython.c | 18 +++++++++--------- src/pl/plpython/plpython.h | 22 +++++++++++----------- src/pl/tcl/pltcl.c | 12 +++++++----- 5 files changed, 38 insertions(+), 36 deletions(-) (limited to 'src/pl') diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 443a8a625dc..0e9ca176ac4 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.37 2001/10/25 05:50:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.38 2002/03/06 06:10:45 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -156,7 +156,7 @@ plpgsql_compile(Oid fn_oid, int functype) */ if (plpgsql_error_funcname != NULL) { - elog(NOTICE, "plpgsql: ERROR during compile of %s near line %d", + elog(WARNING, "plpgsql: ERROR during compile of %s near line %d", plpgsql_error_funcname, plpgsql_error_lineno); plpgsql_error_funcname = NULL; diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index c3f4578617c..25a1684bab7 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.53 2002/02/26 00:00:08 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.54 2002/03/06 06:10:46 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -189,15 +189,15 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo) */ if (error_info_func != NULL) { - elog(NOTICE, "Error occurred while executing PL/pgSQL function %s", + elog(WARNING, "Error occurred while executing PL/pgSQL function %s", error_info_func->fn_name); if (error_info_stmt != NULL) - elog(NOTICE, "line %d at %s", error_info_stmt->lineno, + elog(WARNING, "line %d at %s", error_info_stmt->lineno, plpgsql_stmt_typename(error_info_stmt)); else if (error_info_text != NULL) - elog(NOTICE, "%s", error_info_text); + elog(WARNING, "%s", error_info_text); else - elog(NOTICE, "no more error information available"); + elog(WARNING, "no more error information available"); error_info_func = NULL; error_info_stmt = NULL; @@ -437,15 +437,15 @@ plpgsql_exec_trigger(PLpgSQL_function * func, */ if (error_info_func != NULL) { - elog(NOTICE, "Error occurred while executing PL/pgSQL function %s", + elog(WARNING, "Error occurred while executing PL/pgSQL function %s", error_info_func->fn_name); if (error_info_stmt != NULL) - elog(NOTICE, "line %d at %s", error_info_stmt->lineno, + elog(WARNING, "line %d at %s", error_info_stmt->lineno, plpgsql_stmt_typename(error_info_stmt)); else if (error_info_text != NULL) - elog(NOTICE, "%s", error_info_text); + elog(WARNING, "%s", error_info_text); else - elog(NOTICE, "no more error information available"); + elog(WARNING, "no more error information available"); error_info_func = NULL; error_info_stmt = NULL; diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index b8ccbe9f52f..c0858076f6b 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -29,7 +29,7 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.14 2002/03/02 21:39:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.15 2002/03/06 06:10:47 momjian Exp $ * ********************************************************************* */ @@ -415,7 +415,7 @@ plpython_call_handler(PG_FUNCTION_ARGS) } /* - * elog(NOTICE, "PLy_restart_in_progress is %d", + * elog(DEBUG3, "PLy_restart_in_progress is %d", * PLy_restart_in_progress); */ @@ -506,7 +506,7 @@ PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) (TRIGGER_FIRED_BY_UPDATE(tdata->tg_event))) rv = PLy_modify_tuple(proc, plargs, tdata, rv); else - elog(NOTICE, "plpython: Ignoring modified tuple in DELETE trigger"); + elog(WARNING, "plpython: Ignoring modified tuple in DELETE trigger"); } else if (strcasecmp(srv, "OK")) { @@ -2037,7 +2037,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args) if (!PyErr_Occurred()) PyErr_SetString(PLy_exc_spi_error, "Unknown error in PLy_spi_prepare."); - PLy_elog(NOTICE,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2234,7 +2234,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit) if (!PyErr_Occurred()) PyErr_SetString(PLy_exc_error, "Unknown error in PLy_spi_execute_plan"); - PLy_elog(NOTICE,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2300,7 +2300,7 @@ PLy_spi_execute_query(char *query, int limit) if ((!PLy_restart_in_progress) && (!PyErr_Occurred())) PyErr_SetString(PLy_exc_spi_error, "Unknown error in PLy_spi_execute_query."); - PLy_elog(NOTICE,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2664,7 +2664,7 @@ PLy_log(volatile int level, PyObject * self, PyObject * args) enter(); if (args == NULL) - elog(NOTICE, "plpython, args is NULL in %s", __FUNCTION__); + elog(WARNING, "plpython, args is NULL in %s", __FUNCTION__); so = PyObject_Str(args); if ((so == NULL) || ((sv = PyString_AsString(so)) == NULL)) @@ -2690,7 +2690,7 @@ PLy_log(volatile int level, PyObject * self, PyObject * args) } /* - * ok, this is a NOTICE, or LOG message + * ok, this is a WARNING, or LOG message * * but just in case DON'T long jump out of the interpreter! */ @@ -2828,7 +2828,7 @@ PLy_traceback(int *xlevel) */ if (e == NULL) { - *xlevel = NOTICE; + *xlevel = WARNING; return NULL; } diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index e62d036c83f..c2f6bba6f45 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/pl/plpython/Attic/plpython.h,v 1.5 2001/11/05 17:46:39 momjian Exp $ */ +/* $Header: /cvsroot/pgsql/src/pl/plpython/Attic/plpython.h,v 1.6 2002/03/06 06:10:48 momjian Exp $ */ #ifndef PLPYTHON_H #define PLPYTHON_H @@ -16,21 +16,21 @@ #define RAISE_EXC(V) siglongjmp(Warn_restart, (V)) #else #define RESTORE_N_EXC(N) do { \ - elog(NOTICE, "exception (%d,%d) restore at %s:%d",\ + elog(WARNING, "exception (%d,%d) restore at %s:%d",\ PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__));\ exc_save_calls -= 1; \ memcpy(&Warn_restart, &(buf_##N), sizeof(sigjmp_buf)); } while (0) #define SAVE_N_EXC(N) do { \ exc_save_calls += 1; \ - elog(NOTICE, "exception (%d,%d) save at %s:%d", \ + elog(WARNING, "exception (%d,%d) save at %s:%d", \ PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \ memcpy(&(buf_##N), &Warn_restart, sizeof(sigjmp_buf)); } while (0) #define RERAISE_N_EXC(N) do { \ - elog(NOTICE, "exception (%d,%d) reraise at %s:%d", \ + elog(WARNING, "exception (%d,%d) reraise at %s:%d", \ PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \ siglongjmp(Warn_restart, rv_##N); } while (0) #define RAISE_EXC(V) do { \ - elog(NOTICE, "exception (%d,%d) raise at %s:%d", \ + elog(WARNING, "exception (%d,%d) raise at %s:%d", \ PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \ siglongjmp(Warn_restart, (V)); } while (0) #endif @@ -43,8 +43,8 @@ #if DEBUG_LEVEL #define CALL_LEVEL_INC() do { PLy_call_level += 1; \ - elog(NOTICE, "Level: %d", PLy_call_level); } while (0) -#define CALL_LEVEL_DEC() do { elog(NOTICE, "Level: %d", PLy_call_level); \ + elog(DEBUG3, "Level: %d", PLy_call_level); } while (0) +#define CALL_LEVEL_DEC() do { elog(DEBUG3, "Level: %d", PLy_call_level); \ PLy_call_level -= 1; } while (0) #else #define CALL_LEVEL_INC() do { PLy_call_level += 1; } while (0) @@ -54,10 +54,10 @@ /* temporary debugging macros */ #if DEBUG_LEVEL -#define enter() elog(NOTICE, "Enter(%d): %s", func_enter_calls++,__FUNCTION__) -#define leave() elog(NOTICE, "Leave(%d): %s", func_leave_calls++,__FUNCTION__) -#define mark() elog(NOTICE, "Mark: %s:%d", __FUNCTION__, __LINE__); -#define refc(O) elog(NOTICE, "Ref<%p>:<%d>:%s:%d", (O), (((O) == NULL) ? -1 : (O)->ob_refcnt), __FUNCTION__, __LINE__) +#define enter() elog(DEBUG3, "Enter(%d): %s", func_enter_calls++,__FUNCTION__) +#define leave() elog(DEBUG3, "Leave(%d): %s", func_leave_calls++,__FUNCTION__) +#define mark() elog(DEBUG3, "Mark: %s:%d", __FUNCTION__, __LINE__); +#define refc(O) elog(DEBUG3, "Ref<%p>:<%d>:%s:%d", (O), (((O) == NULL) ? -1 : (O)->ob_refcnt), __FUNCTION__, __LINE__) #else #define enter() #define leave() diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 96bf073ed41..ebc7b8fb884 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -31,7 +31,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.50 2002/03/02 21:39:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.51 2002/03/06 06:10:48 momjian Exp $ * **********************************************************************/ @@ -345,7 +345,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp) if (SPI_processed == 0) { Tcl_DStringFree(&unknown_src); - elog(NOTICE, "pltcl: Module unknown not found in pltcl_modules"); + elog(WARNING, "pltcl: Module unknown not found in pltcl_modules"); return; } @@ -826,7 +826,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS) if (Tcl_SplitList(interp, interp->result, &ret_numvals, &ret_values) != TCL_OK) { - elog(NOTICE, "pltcl: cannot split return value from trigger"); + elog(WARNING, "pltcl: cannot split return value from trigger"); elog(ERROR, "pltcl: %s", interp->result); } @@ -1259,9 +1259,11 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp, return TCL_ERROR; } - if (strcmp(argv[1], "NOTICE") == 0) + if (strcmp(argv[1], "INFO") == 0) + level = INFO; + else if (strcmp(argv[1], "NOTICE") == 0) level = NOTICE; - else if (strcmp(argv[1], "WARN") == 0) + else if (strcmp(argv[1], "WARNING") == 0) level = ERROR; else if (strcmp(argv[1], "ERROR") == 0) level = ERROR; -- cgit v1.2.3