rayzor

view src/logger.c @ 0:2a5340a6eee4

rayzor first commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Apr 2014 08:46:27 +0300
parents
children a826bf0fb169
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 printlog(const char *fmt, ...)
10 {
11 va_list ap;
13 if(!logfile) {
14 if(!(logfile = fopen(LOGFNAME, "w"))) {
15 return;
16 }
17 setvbuf(logfile, 0, _IOLBF, 0);
18 }
20 va_start(ap, fmt);
21 vfprintf(logfile, fmt, ap);
22 va_end(ap);
23 }