diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-05-05 12:34:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-05-06 03:42:13 +0200 |
commit | 6eda8a85b84c4e661a8763429ae1978f8da7f9dd (patch) | |
tree | 5169e1bf6779f7442235f36a206a91e224cda05d /video-ps3eye/PS3EYEDriver/log.hpp | |
parent | 12dfd6dcf60d9fefef7f8723fb9bc5a21fdb5b61 (diff) |
video/ps3eye: WIP
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 |