Mercurial > hg > fxanalyse
view logging.h @ 241:65ab87e5a8d6
Add ZMQ library
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Thu, 12 Feb 2015 22:43:46 +0100 |
parents | ec81395bf08d |
children | 307fd62f376d |
line wrap: on
line source
#ifndef __LOGGING_H__ #define __LOGGING_H__ /* required for the user interface defines */ #include "FXAnalyse.h" #include "utils.h" struct logger { unsigned int panel; int fd; void(*onerror)(int, const char *); } __logger; /* an ERROR macro is defined in `WinGDI.h` which is included * by some other header file included before this. to be on * the safe side we define the enum lable to the same value */ #undef ERROR enum loglevel { ERROR = 0, DEBUG, INFO, WARNING, }; 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(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) #endif