| 1 | #ifndef FIO_LOG_H |
| 2 | #define FIO_LOG_H |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | extern FILE *f_out; |
| 7 | extern FILE *f_err; |
| 8 | |
| 9 | /* |
| 10 | * If logging output to a file, stderr should go to both stderr and f_err |
| 11 | */ |
| 12 | #define log_err(args...) do { \ |
| 13 | fprintf(f_err, ##args); \ |
| 14 | if (f_err != stderr) \ |
| 15 | fprintf(stderr, ##args); \ |
| 16 | } while (0) |
| 17 | |
| 18 | #define log_info(args...) fprintf(f_out, ##args) |
| 19 | #define log_valist(str, args) vfprintf(f_out, (str), (args)) |
| 20 | |
| 21 | FILE *get_f_out(void); |
| 22 | FILE *get_f_err(void); |
| 23 | |
| 24 | #endif |