rayzor

view src/logger.c @ 17:79609d482762

the renderer renders, also fixed an unnoticed matrix conversion problem between scenegraph and min3d
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 14 Apr 2014 07:34:45 +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 }