goat3d
diff exporters/maxgoat/src/logger.cc @ 61:fdece14403ff
max gui
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 31 Mar 2014 09:41:47 +0300 |
parents | |
children | 9862541fdcf5 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/exporters/maxgoat/src/logger.cc Mon Mar 31 09:41:47 2014 +0300 1.3 @@ -0,0 +1,31 @@ 1.4 +#include <stdio.h> 1.5 +#include <stdarg.h> 1.6 +#include "logger.h" 1.7 + 1.8 +static FILE *logfile; 1.9 + 1.10 +bool maxlog_open(const char *fname) 1.11 +{ 1.12 + if(!(logfile = fopen(fname, "wb"))) { 1.13 + return false; 1.14 + } 1.15 + setvbuf(logfile, 0, _IONBF, 0); 1.16 + return true; 1.17 +} 1.18 + 1.19 +void maxlog_close() 1.20 +{ 1.21 + if(logfile) { 1.22 + fclose(logfile); 1.23 + } 1.24 +} 1.25 + 1.26 +void maxlog(const char *fmt, ...) 1.27 +{ 1.28 + if(!logfile) return; 1.29 + 1.30 + va_list ap; 1.31 + va_start(ap, fmt); 1.32 + vfprintf(logfile, fmt, ap); 1.33 + va_end(ap); 1.34 +} 1.35 \ No newline at end of file