Mercurial > hg > fxanalyse
annotate logging.h @ 251:307fd62f376d
Implement log file rotation
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Thu, 28 May 2015 16:12:18 +0200 |
parents | ec81395bf08d |
children | d948e3ced2b9 |
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 |
251
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
8 struct logger *__logger; |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
9 |
239
ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
199
diff
changeset
|
10 /* 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
|
11 * 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
|
12 * 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
|
13 #undef ERROR |
ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
199
diff
changeset
|
14 |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
15 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
|
16 ERROR = 0, |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
17 DEBUG, |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
18 INFO, |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
19 WARNING, |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
20 }; |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
21 |
199
111610d871af
Show error state in main user inteface panel
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
169
diff
changeset
|
22 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
|
23 void __logmessage(struct logger *l, enum loglevel level, const char *frmt, ...); |
251
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
24 int __logger_panel_visible(struct logger *l, int visible); |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
25 |
251
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
26 #define logger_init(onerror) __logger_init(__logger, onerror) |
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
27 #define logmessage(level, msg, ...) __logmessage(__logger, (level), (msg), ##__VA_ARGS__) |
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
28 #define logmsg(msg, ...) __logmessage(__logger, INFO, msg, ##__VA_ARGS__) |
307fd62f376d
Implement log file rotation
Daniele Nicolodi <daniele@grinta.net>
parents:
239
diff
changeset
|
29 #define logger_panel_visible(visible) __logger_panel_visible(__logger, visible) |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
30 |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
31 #endif |