rayzor
annotate src/logger.c @ 2:c273c6f799a4
added fixcase utility to fix the ftp-ed files' case on linux
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Apr 2014 18:31:00 +0300 |
parents | 2a5340a6eee4 |
children | a68dbf80d547 |
rev | line source |
---|---|
nuclear@1 | 1 #include <stdio.h> |
nuclear@1 | 2 #include <stdarg.h> |
nuclear@1 | 3 #include "logger.h" |
nuclear@1 | 4 |
nuclear@1 | 5 #define LOGFNAME "rayzor.log" |
nuclear@1 | 6 |
nuclear@1 | 7 static FILE *logfile; |
nuclear@1 | 8 |
nuclear@1 | 9 void printlog(const char *fmt, ...) |
nuclear@1 | 10 { |
nuclear@1 | 11 va_list ap; |
nuclear@1 | 12 |
nuclear@1 | 13 if(!logfile) { |
nuclear@1 | 14 if(!(logfile = fopen(LOGFNAME, "w"))) { |
nuclear@1 | 15 return; |
nuclear@1 | 16 } |
nuclear@1 | 17 setvbuf(logfile, 0, _IOLBF, 0); |
nuclear@1 | 18 } |
nuclear@1 | 19 |
nuclear@1 | 20 va_start(ap, fmt); |
nuclear@1 | 21 vfprintf(logfile, fmt, ap); |
nuclear@1 | 22 va_end(ap); |
nuclear@1 | 23 } |