/* Special behavior before we start full operation */
fprintf(stderr, "%s: %s\n", log_severity_names[sev], msgbuf);
}
+ if (sev == LOG_FATAL) {
+ assert(0 && "fatal message logged");
+ _exit(1);
+ }
}
/* audit log searching */
unsigned int matched = 0;
if (discrim->type) {
+ static volatile struct logEntry *last;
struct logEntry *entry;
- for (entry = discrim->type->log_oldest; entry; entry = entry->next) {
+ for (entry = discrim->type->log_oldest, last = NULL;
+ entry;
+ last = entry, entry = entry->next) {
+ verify(entry);
if (entry_match(discrim, entry)) {
esf(entry, data);
if (++matched >= discrim->limit)
message_register_table(msgtab);
log_inited = 1;
}
+
+void SyncLog(char *fmt,...)
+{
+ va_list args;
+ char buff[MAXLEN*4];
+ char *tmp;
+ FILE *LogFile;
+
+ va_start(args, fmt);
+ vsnprintf(buff, MAXLEN, fmt, args);
+ buff[MAXLEN - 1] = '\0';
+ va_end(args);
+
+ for (tmp = buff; *tmp; tmp++)
+ {
+ if ((*tmp == '\n') || (*tmp == '\r'))
+ *tmp = '\0';
+ else if (*tmp == '\001')
+ *tmp = ' ';
+ }
+
+ if((LogFile = fopen("sync.log", "a")))
+ {
+ fprintf(LogFile, "%s: %s\n", time2str(time(NULL)), buff);
+ fclose(LogFile);
+ }
+
+}