diff options
author | Johns <johns98@gmx.net> | 2012-01-02 15:21:58 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-01-02 15:21:58 +0100 |
commit | 3b7688b78be8cf98bb3ae778a663863d9131884c (patch) | |
tree | 7edcf01884f00c9c249673d1ed74cd10bc0c4617 /misc.h | |
parent | d2606a5d5fadac64d9f78b72df9f3a404925f488 (diff) | |
download | vdr-plugin-softhddevice-3b7688b78be8cf98bb3ae778a663863d9131884c.tar.gz vdr-plugin-softhddevice-3b7688b78be8cf98bb3ae778a663863d9131884c.tar.bz2 |
Print debug only, if compiled with -DDEBUG.
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -1,7 +1,7 @@ /// /// @file misc.h @brief Misc function header file /// -/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2012 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// Copied from uwm. @@ -46,24 +46,28 @@ extern int SysLogLevel; ///< how much information wanted // Prototypes ////////////////////////////////////////////////////////////////////////////// -static inline void Debug(const int, const char *format, ...) +static inline void Syslog(const int, const char *format, ...) __attribute__ ((format(printf, 2, 3))); ////////////////////////////////////////////////////////////////////////////// // Inlines ////////////////////////////////////////////////////////////////////////////// +#ifdef DEBUG #define DebugLevel 4 /// private debug level +#else +#define DebugLevel 0 /// private debug level +#endif /** -** Debug output function. +** Syslog output function. ** ** - 0 fatal errors and errors ** - 1 warnings ** - 2 info ** - 3 important debug and fixme's */ -static inline void Debug(const int level, const char *format, ...) +static inline void Syslog(const int level, const char *format, ...) { if (SysLogLevel > level || DebugLevel > level) { va_list ap; @@ -77,7 +81,7 @@ static inline void Debug(const int level, const char *format, ...) /** ** Show error. */ -#define Error(fmt...) Debug(0, fmt) +#define Error(fmt...) Syslog(0, fmt) /** ** Show fatal error. @@ -87,12 +91,21 @@ static inline void Debug(const int level, const char *format, ...) /** ** Show warning. */ -#define Warning(fmt...) Debug(1, fmt) +#define Warning(fmt...) Syslog(1, fmt) /** ** Show info. */ -#define Info(fmt...) Debug(2, fmt) +#define Info(fmt...) Syslog(2, fmt) + +/** +** Show debug. +*/ +#ifdef DEBUG +#define Debug(level, fmt...) Syslog(level, fmt) +#else +#define Debug(level, fmt...) /* disabled */ +#endif /** ** Get ticks in ms. |