amiga_imgv

view src/logger.c @ 2:f75893a33234

hammer -> ham image converter
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Oct 2017 10:04:29 +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 }