popnhax/util/log.h

19 lines
317 B
C
Raw Normal View History

2023-06-30 00:56:02 +02:00
#ifndef __LOG_H__
#define __LOG_H__
2023-07-09 21:34:07 +02:00
#include <cstdio>
2023-06-30 00:56:02 +02:00
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
extern FILE *g_log_fp;
#define LOG(...) do { \
2023-07-10 21:35:09 +02:00
if (g_log_fp != NULL) { \
2023-06-30 00:56:02 +02:00
fprintf(g_log_fp, __VA_ARGS__); \
fflush(g_log_fp);\
2023-07-09 21:34:07 +02:00
}\
fprintf(stderr, __VA_ARGS__); \
2023-06-30 00:56:02 +02:00
} while (0)
#endif