Signed-off-by: Colin McCabe <[email protected]>
---
include/hail_log.h | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 include/hail_log.h
diff --git a/include/hail_log.h b/include/hail_log.h
new file mode 100644
index 0000000..f825b89
--- /dev/null
+++ b/include/hail_log.h
@@ -0,0 +1,31 @@
+#ifndef __HAIL_LOG_H__
+#define __HAIL_LOG_H__
+
+struct hail_log {
+ void (*func)(int prio, const char *fmt, ...);
+ bool verbose;
+};
+
+/** Print out a debug message if 'verbose' is enabled */
+#define HAIL_DEBUG(log, ...) \
+ if ((log)->verbose) { \
+ (log)->func(LOG_DEBUG, __VA_ARGS__); \
+ }
+
+/** Print out an informational log message */
+#define HAIL_INFO(log, ...) \
+ (log)->func(LOG_INFO, __VA_ARGS__);
+
+/** Print out a warning message */
+#define HAIL_WARN(log, ...) \
+ (log)->func(LOG_WARNING, __VA_ARGS__);
+
+/** Print out an error message */
+#define HAIL_ERR(log, ...) \
+ (log)->func(LOG_ERR, __VA_ARGS__);
+
+/** Print out a critical warning message */
+#define HAIL_CRIT(log, ...) \
+ (log)->func(LOG_CRIT, __VA_ARGS__);
+
+#endif /* __HAIL_LOG_H__ */
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html