goat3d
annotate exporters/maxgoat/src/logger.cc @ 77:4b653386a154
fixed newline
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 08 May 2014 13:55:13 +0300 |
parents | fdece14403ff |
children |
rev | line source |
---|---|
nuclear@73 | 1 #include <stdio.h> |
nuclear@73 | 2 #include <stdarg.h> |
nuclear@73 | 3 #include "logger.h" |
nuclear@73 | 4 |
nuclear@73 | 5 static FILE *logfile; |
nuclear@73 | 6 |
nuclear@73 | 7 bool maxlog_open(const char *fname) |
nuclear@73 | 8 { |
nuclear@73 | 9 if(!(logfile = fopen(fname, "wb"))) { |
nuclear@73 | 10 return false; |
nuclear@73 | 11 } |
nuclear@73 | 12 setvbuf(logfile, 0, _IONBF, 0); |
nuclear@73 | 13 return true; |
nuclear@73 | 14 } |
nuclear@73 | 15 |
nuclear@73 | 16 void maxlog_close() |
nuclear@73 | 17 { |
nuclear@73 | 18 if(logfile) { |
nuclear@73 | 19 fclose(logfile); |
nuclear@73 | 20 } |
nuclear@73 | 21 } |
nuclear@73 | 22 |
nuclear@73 | 23 void maxlog(const char *fmt, ...) |
nuclear@73 | 24 { |
nuclear@73 | 25 if(!logfile) return; |
nuclear@73 | 26 |
nuclear@73 | 27 va_list ap; |
nuclear@73 | 28 va_start(ap, fmt); |
nuclear@73 | 29 vfprintf(logfile, fmt, ap); |
nuclear@73 | 30 va_end(ap); |
nuclear@73 | 31 } |