diff options
Diffstat (limited to 'video-ps3eye/PS3EYEDriver/log.hpp')
-rw-r--r-- | video-ps3eye/PS3EYEDriver/log.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/video-ps3eye/PS3EYEDriver/log.hpp b/video-ps3eye/PS3EYEDriver/log.hpp new file mode 100644 index 00000000..6ae50028 --- /dev/null +++ b/video-ps3eye/PS3EYEDriver/log.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include <cstdio> + +template<unsigned N, unsigned M, typename... xs> +void ps3eye_log(const char (&prefix)[N], const char (&fmt)[M], const xs&... args) +{ + fprintf(stderr, "%s ", prefix); + fprintf(stderr, fmt, args...); + if constexpr(M > 1) + if (fmt[M-2] != '\n') + fprintf(stderr, "\n"); + fflush(stderr); +} + +#define warn(...) ps3eye_log("[ps3eye warn]", __VA_ARGS__) + +#define PS3_EYE_DEBUG + +#ifdef PS3_EYE_DEBUG +# define debug(...) ps3eye_log("[ps3eye debug]", __VA_ARGS__) +# define debug2(...) ps3eye_log("[ps3eye debug2]", __VA_ARGS__) +#else +# define debug(...) ((void)0) +# define debug2(...) ((void)0) +#endif |