[PATCH] When logging to a file, stderr should go both to stderr and file
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index f6c2ee3bd81cd149b7f8da4866e48c32750765b7..2d57227c53cf13a68d15131d55e23376308d9295 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -441,4 +441,13 @@ static inline void fio_sem_up(volatile int volatile *sem)
        (*sem)++;
 }
 
+/*
+ * If logging output to a file, stderr should go to both stderr and f_err
+ */
+#define log_err(args...)       do {            \
+       fprintf(f_err, ##args);                 \
+       if (f_err != stderr)                    \
+               fprintf(stderr, ##args);        \
+       } while (0)
+
 #endif