diff logging.h @ 199:111610d871af

Show error state in main user inteface panel
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 31 Mar 2014 17:03:37 +0200
parents 97112b45b838
children ec81395bf08d
line wrap: on
line diff
--- a/logging.h	Mon Mar 31 17:03:37 2014 +0200
+++ b/logging.h	Mon Mar 31 17:03:37 2014 +0200
@@ -8,6 +8,7 @@
 struct logger {
 	unsigned int panel;
 	int fd;
+	void(*onerror)(int, const char *);
 } __logger;
 
 enum loglevel {
@@ -17,10 +18,10 @@
 	ERROR,
 };
 
-int __logger_init(struct logger *l);
+int __logger_init(struct logger *l, void(*onerror)(int, const char *));
 void __logmessage(struct logger *l, enum loglevel level, const char *frmt, ...);
 
-#define logger_init() __logger_init(&__logger)
+#define logger_init(onerror) __logger_init(&__logger, onerror)
 #define logmessage(level, msg, ...) __logmessage(&__logger, (level), (msg), ##__VA_ARGS__)
 #define logmsg(msg, ...) __logmessage(&__logger, INFO, msg, ##__VA_ARGS__)
 #define logger_panel_visible(visible)  SetPanelAttribute(__logger.panel, ATTR_VISIBLE, visible)