1 /* 2 * See Licensing and Copyright notice in naev.h 3 */ 4 5 6 7 8 #ifndef LOG_H 9 # define LOG_H 10 11 12 #include <stdio.h> 13 #include <signal.h> 14 15 16 #define LOG(str, args...) (logprintf(stdout,str"\n", ## args)) 17 #ifdef DEBUG_PARANOID /* Will cause WARNs to blow up */ 18 #define WARN(str, args...) (logprintf(stderr,"Warning: [%s] "str"\n", __func__, ## args), abort()) 19 #else /* DEBUG_PARANOID */ 20 #define WARN(str, args...) (logprintf(stderr,"Warning: [%s] "str"\n", __func__, ## args)) 21 #endif /* DEBUG_PARANOID */ 22 #define ERR(str, args...) (logprintf(stderr,"ERROR %s:%d [%s]: "str"\n", __FILE__, __LINE__, __func__, ## args), abort()) 23 #ifdef DEBUG 24 # undef DEBUG 25 # define DEBUG(str, args...) LOG(str, ## args) 26 #ifndef DEBUGGING 27 # define DEBUGGING 28 #endif /* DEBUGGING */ 29 #else /* DEBUG */ 30 # define DEBUG(str, args...) do {;} while(0) 31 #endif /* DEBUG */ 32 33 34 int logprintf( FILE *stream, const char *fmt, ... ); 35 void log_redirect (void); 36 int log_isTerminal (void); 37 void log_copy( int enable ); 38 int log_copying (void); 39 void log_purge (void); 40 void log_clean (void); 41 42 43 #endif /* LOG_H */ 44