*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/10 20:48:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.162 2005/08/12 21:36:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static void
write_eventlog(int level, const char *line)
{
+ int eventlevel = EVENTLOG_ERROR_TYPE;
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
if (evtHandle == INVALID_HANDLE_VALUE)
}
}
+ switch (level)
+ {
+ case DEBUG5:
+ case DEBUG4:
+ case DEBUG3:
+ case DEBUG2:
+ case DEBUG1:
+ case LOG:
+ case COMMERROR:
+ case INFO:
+ case NOTICE:
+ eventlevel = EVENTLOG_INFORMATION_TYPE;
+ break;
+ case WARNING:
+ eventlevel = EVENTLOG_WARNING_TYPE;
+ break;
+ case ERROR:
+ case FATAL:
+ case PANIC:
+ default:
+ eventlevel = EVENTLOG_ERROR_TYPE;
+ break;
+ }
+
+
ReportEvent(evtHandle,
- level,
+ eventlevel,
0,
0, /* All events are Id 0 */
NULL,
/* Write to eventlog, if enabled */
if (Log_destination & LOG_DESTINATION_EVENTLOG)
{
- int eventlog_level;
-
- switch (edata->elevel)
- {
- case DEBUG5:
- case DEBUG4:
- case DEBUG3:
- case DEBUG2:
- case DEBUG1:
- case LOG:
- case COMMERROR:
- case INFO:
- case NOTICE:
- eventlog_level = EVENTLOG_INFORMATION_TYPE;
- break;
- case WARNING:
- eventlog_level = EVENTLOG_WARNING_TYPE;
- break;
- case ERROR:
- case FATAL:
- case PANIC:
- default:
- eventlog_level = EVENTLOG_ERROR_TYPE;
- break;
- }
- write_eventlog(eventlog_level, buf.data);
+ write_eventlog(edata->elevel, buf.data);
}
#endif /* WIN32 */
* because that's really a pipe to the syslogger process.
*/
if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
- write_eventlog(EVENTLOG_ERROR_TYPE, buf.data);
+ write_eventlog(edata->elevel, buf.data);
else
#endif
fprintf(stderr, "%s", buf.data);