annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1 #ifndef __LOGGING_H__
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 #define __LOGGING_H__
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
3
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
4 /* required for the user interface defines */
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
5 #include "FXAnalyse.h"
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6 #include "utils.h"
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
7
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 struct logger {
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9 unsigned int panel;
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10 int fd;
199
111610d871af Show error state in main user inteface panel
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
11 void(*onerror)(int, const char *);
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12 } __logger;
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13
239
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
14 /* an ERROR macro is defined in `WinGDI.h` which is included
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
15 * by some other header file included before this. to be on
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
16 * the safe side we define the enum lable to the same value */
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
17 #undef ERROR
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
18
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
19 enum loglevel {
239
ec81395bf08d Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 199
diff changeset
20 ERROR = 0,
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
21 DEBUG,
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22 INFO,
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23 WARNING,
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
24 };
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25
199
111610d871af Show error state in main user inteface panel
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
26 int __logger_init(struct logger *l, void(*onerror)(int, const char *));
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
27 void __logmessage(struct logger *l, enum loglevel level, const char *frmt, ...);
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
28
199
111610d871af Show error state in main user inteface panel
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
29 #define logger_init(onerror) __logger_init(&__logger, onerror)
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
30 #define logmessage(level, msg, ...) __logmessage(&__logger, (level), (msg), ##__VA_ARGS__)
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
31 #define logmsg(msg, ...) __logmessage(&__logger, INFO, msg, ##__VA_ARGS__)
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
32 #define logger_panel_visible(visible) SetPanelAttribute(__logger.panel, ATTR_VISIBLE, visible)
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
33
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
34 #endif