Mercurial > hg > fxanalyse
comparison 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 |
comparison
equal
deleted
inserted
replaced
250:9b35a2b2c759 | 251:307fd62f376d |
---|---|
3 | 3 |
4 /* required for the user interface defines */ | 4 /* required for the user interface defines */ |
5 #include "FXAnalyse.h" | 5 #include "FXAnalyse.h" |
6 #include "utils.h" | 6 #include "utils.h" |
7 | 7 |
8 struct logger { | 8 struct logger *__logger; |
9 unsigned int panel; | |
10 int fd; | |
11 void(*onerror)(int, const char *); | |
12 } __logger; | |
13 | 9 |
14 /* an ERROR macro is defined in `WinGDI.h` which is included | 10 /* an ERROR macro is defined in `WinGDI.h` which is included |
15 * by some other header file included before this. to be on | 11 * by some other header file included before this. to be on |
16 * the safe side we define the enum lable to the same value */ | 12 * the safe side we define the enum lable to the same value */ |
17 #undef ERROR | 13 #undef ERROR |
23 WARNING, | 19 WARNING, |
24 }; | 20 }; |
25 | 21 |
26 int __logger_init(struct logger *l, void(*onerror)(int, const char *)); | 22 int __logger_init(struct logger *l, void(*onerror)(int, const char *)); |
27 void __logmessage(struct logger *l, enum loglevel level, const char *frmt, ...); | 23 void __logmessage(struct logger *l, enum loglevel level, const char *frmt, ...); |
24 int __logger_panel_visible(struct logger *l, int visible); | |
28 | 25 |
29 #define logger_init(onerror) __logger_init(&__logger, onerror) | 26 #define logger_init(onerror) __logger_init(__logger, onerror) |
30 #define logmessage(level, msg, ...) __logmessage(&__logger, (level), (msg), ##__VA_ARGS__) | 27 #define logmessage(level, msg, ...) __logmessage(__logger, (level), (msg), ##__VA_ARGS__) |
31 #define logmsg(msg, ...) __logmessage(&__logger, INFO, msg, ##__VA_ARGS__) | 28 #define logmsg(msg, ...) __logmessage(__logger, INFO, msg, ##__VA_ARGS__) |
32 #define logger_panel_visible(visible) SetPanelAttribute(__logger.panel, ATTR_VISIBLE, visible) | 29 #define logger_panel_visible(visible) __logger_panel_visible(__logger, visible) |
33 | 30 |
34 #endif | 31 #endif |