amiga_imgv

view src/logger.c @ 5:0d3d7b020e6a

progress...
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Oct 2017 12:32:24 +0300
parents
children ae0ada629b03
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdarg.h>
4 #include "logger.h"
6 static FILE *fp;
8 static void init(void)
9 {
10 if(!(fp = fopen("logfile", "w"))) {
11 printf("failed to open logfile\n");
12 abort();
13 }
14 setvbuf(fp, 0, _IONBF, 0);
15 }
17 void logmsg(const char *fmt, ...)
18 {
19 va_list ap;
21 if(!fp) init();
23 va_start(ap, fmt);
24 vfprintf(fp, fmt, ap);
25 va_end(ap);
26 }