nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include "logger.h" nuclear@0: nuclear@0: static FILE *fp; nuclear@0: nuclear@0: static void init(void) nuclear@0: { nuclear@0: if(!(fp = fopen("logfile", "w"))) { nuclear@0: printf("failed to open logfile\n"); nuclear@0: abort(); nuclear@0: } nuclear@0: setvbuf(fp, 0, _IONBF, 0); nuclear@0: } nuclear@0: nuclear@0: void logmsg(const char *fmt, ...) nuclear@0: { nuclear@0: va_list ap; nuclear@0: nuclear@0: if(!fp) init(); nuclear@0: nuclear@0: va_start(ap, fmt); nuclear@0: vfprintf(fp, fmt, ap); nuclear@0: va_end(ap); nuclear@0: }