- if(isDaemon)
- closelog();
-}
-
-/**
- * This function should be used as central logging facility.
- * 'type' argument should be one of following:
- *
- * LOG_EMERG system is unusable
- * LOG_ALERT action must be taken immediately
- * LOG_CRIT critical conditions
- * LOG_ERR error conditions
- * LOG_WARNING warning conditions
- * LOG_NOTICE normal but significant condition
- * LOG_INFO informational
- * LOG_DEBUG debug-level messages
- */
-static void log(int type, char *format, ...)
-{
- va_list ap;
-
-#ifndef DEBUG
- if(type==LOG_DEBUG)
- return;
-#endif
-
- va_start(ap, format);
-
- if(isDaemon)
- {
- char buffer[MAX_LOG_MSG_SIZE];
-
- (void)vsnprintf(buffer, MAX_LOG_MSG_SIZE, format, ap);
- syslog(type,buffer);
- } else
- {
- (void) fprintf(stderr, "icmpmonitor[%d]:", (int)getpid());
- (void) vfprintf(stderr, format, ap);
- (void) fprintf(stderr, "\n");