Commit de4f4b6c authored by Danny Mayer's avatar Danny Mayer
Browse files

Added NTReportError to use when the Event Log is not open for updates

parent 498e1c30
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: syslog.c,v 1.4 2001/11/27 00:56:24 gson Exp $ */ /* $Id: syslog.c,v 1.5 2002/08/01 03:43:31 mayer Exp $ */
#include <config.h> #include <config.h>
...@@ -78,7 +78,7 @@ isc_syslog_facilityfromstring(const char *str, int *facilityp) { ...@@ -78,7 +78,7 @@ isc_syslog_facilityfromstring(const char *str, int *facilityp) {
REQUIRE(str != NULL); REQUIRE(str != NULL);
REQUIRE(facilityp != NULL); REQUIRE(facilityp != NULL);
for (i = 0; facilities[i].strval != NULL; i++) { for (i = 0 ; facilities[i].strval != NULL ; i++) {
if (strcasecmp(facilities[i].strval, str) == 0) { if (strcasecmp(facilities[i].strval, str) == 0) {
*facilityp = facilities[i].val; *facilityp = facilities[i].val;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
...@@ -159,4 +159,20 @@ InitNTLogging(FILE *stream, int debug) { ...@@ -159,4 +159,20 @@ InitNTLogging(FILE *stream, int debug) {
log_stream = stream; log_stream = stream;
ModifyLogLevel(debug); ModifyLogLevel(debug);
} }
/*
* This function is for reporting errors to the application
* event log in case the regular syslog is not available
* mainly during startup. It should not be used under normal
* circumstances.
*/
void
NTReportError(const char *name, const char *str) {
HANDLE hNTAppLog = NULL;
hNTAppLog = RegisterEventSource(NULL, name);
ReportEvent(hNTAppLog, EVENTLOG_ERROR_TYPE, 0,
BIND_ERR_MSG, NULL, 1, 0,(LPCSTR *) str, NULL);
DeregisterEventSource(hNTAppLog);
}
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: syslog.h,v 1.3 2001/07/09 21:06:20 gson Exp $ */ /* $Id: syslog.h,v 1.4 2002/08/01 03:43:31 mayer Exp $ */
#ifndef _SYSLOG_H #ifndef _SYSLOG_H
#define _SYSLOG_H #define _SYSLOG_H
...@@ -66,6 +66,8 @@ ModifyLogLevel(int level); ...@@ -66,6 +66,8 @@ ModifyLogLevel(int level);
void void
InitNTLogging(FILE *, int); InitNTLogging(FILE *, int);
void
NTReportError(const char *, const char *);
/* /*
* Include the event codes required for logging. * Include the event codes required for logging.
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment