goat3d

annotate exporters/maxgoat/src/logger.cc @ 90:8b156bc5205b

[maxgoat] fixed the transform export bug [goatview] added widgets for the animation controls [goatview] added a grid ground plane with automatic sizing and transitions from size to size
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 May 2014 06:26:24 +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 }