rayzor

view src/logger.c @ 14:a9a948809c6f

starting the renderer screen, plus misc stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Apr 2014 08:06:21 +0300
parents a826bf0fb169
children
line source
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include "logger.h"
5 #define LOGFNAME "rayzor.log"
7 static FILE *logfile;
9 void logger_output(FILE *fp)
10 {
11 if(logfile) fclose(logfile);
12 logfile = fp;
13 }
15 void printlog(const char *fmt, ...)
16 {
17 va_list ap;
19 if(!logfile) {
20 if(!(logfile = fopen(LOGFNAME, "w"))) {
21 return;
22 }
23 setvbuf(logfile, 0, _IOLBF, 0);
24 }
26 va_start(ap, fmt);
27 vfprintf(logfile, fmt, ap);
28 va_end(ap);
29 }