1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* elog.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES error logging definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2000-12-18 01:44:50 +01:00
|
|
|
* $Id: elog.h,v 1.21 2000/12/18 00:44:50 tgl Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef ELOG_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define ELOG_H
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define NOTICE 0 /* random info - no special action */
|
1999-09-11 21:06:42 +02:00
|
|
|
#define ERROR (-1) /* user error - return to known state */
|
|
|
|
#define FATAL 1 /* fatal error - abort process */
|
2000-04-12 19:17:23 +02:00
|
|
|
#define REALLYFATAL 2 /* take down the other backends with me */
|
|
|
|
#define STOP REALLYFATAL
|
1999-09-11 21:06:42 +02:00
|
|
|
#define DEBUG (-2) /* debug message */
|
2000-04-12 19:17:23 +02:00
|
|
|
#define LOG DEBUG
|
1999-09-11 21:06:42 +02:00
|
|
|
#define NOIND (-3) /* debug message, don't indent as far */
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-05-31 02:28:42 +02:00
|
|
|
#ifdef ENABLE_SYSLOG
|
|
|
|
extern int Use_syslog;
|
|
|
|
#endif
|
|
|
|
|
2000-12-03 11:27:29 +01:00
|
|
|
/*
|
2000-12-18 01:44:50 +01:00
|
|
|
* If CritSectionCount > 0, signal handlers mustn't do
|
2000-12-06 18:25:46 +01:00
|
|
|
* elog(ERROR|FATAL), instead remember what action is
|
2000-12-18 01:44:50 +01:00
|
|
|
* required with QueryCancel & ProcDiePending.
|
2000-12-03 11:27:29 +01:00
|
|
|
*/
|
2000-12-18 01:44:50 +01:00
|
|
|
extern uint32 CritSectionCount; /* duplicates access/xlog.h */
|
2000-12-06 18:25:46 +01:00
|
|
|
extern bool QueryCancel; /* duplicates miscadmin.h */
|
2000-12-18 01:44:50 +01:00
|
|
|
extern bool ProcDiePending;
|
2000-12-06 18:25:46 +01:00
|
|
|
|
2000-12-18 01:44:50 +01:00
|
|
|
#define START_CRIT_CODE (CritSectionCount++)
|
2000-12-06 18:25:46 +01:00
|
|
|
|
|
|
|
#define END_CRIT_CODE \
|
|
|
|
do { \
|
2000-12-18 01:44:50 +01:00
|
|
|
if (CritSectionCount == 0) \
|
2000-12-06 18:25:46 +01:00
|
|
|
elog(STOP, "Not in critical section"); \
|
2000-12-18 01:44:50 +01:00
|
|
|
CritSectionCount--; \
|
|
|
|
if (CritSectionCount == 0 && QueryCancel) \
|
2000-12-06 18:25:46 +01:00
|
|
|
{ \
|
2000-12-18 01:44:50 +01:00
|
|
|
if (ProcDiePending) \
|
2000-12-06 18:25:46 +01:00
|
|
|
elog(FATAL, "The system is shutting down"); \
|
|
|
|
else \
|
|
|
|
elog(ERROR, "Query was cancelled."); \
|
|
|
|
} \
|
|
|
|
} while(0)
|
2000-12-03 11:27:29 +01:00
|
|
|
|
2000-06-04 17:06:34 +02:00
|
|
|
extern bool Log_timestamp;
|
|
|
|
extern bool Log_pid;
|
|
|
|
|
2000-01-13 19:26:18 +01:00
|
|
|
#ifndef __GNUC__
|
2000-04-12 19:17:23 +02:00
|
|
|
extern void elog(int lev, const char *fmt,...);
|
|
|
|
|
2000-01-13 19:26:18 +01:00
|
|
|
#else
|
|
|
|
/* This extension allows gcc to check the format string for consistency with
|
|
|
|
the supplied arguments. */
|
2000-04-12 19:17:23 +02:00
|
|
|
extern void elog(int lev, const char *fmt,...) __attribute__((format(printf, 2, 3)));
|
|
|
|
|
2000-01-13 19:26:18 +01:00
|
|
|
#endif
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1996-11-06 11:15:25 +01:00
|
|
|
#ifndef PG_STANDALONE
|
1999-09-11 21:06:42 +02:00
|
|
|
extern int DebugFileOpen(void);
|
2000-04-12 19:17:23 +02:00
|
|
|
|
1996-11-06 11:15:25 +01:00
|
|
|
#endif
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* ELOG_H */
|