Mercurial > hg > fxanalyse
diff logging.c @ 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 | 0fed60877099 |
children | 28a56e4c06a4 |
line wrap: on
line diff
--- a/logging.c Mon Mar 31 17:03:37 2014 +0200 +++ b/logging.c Mon Mar 31 17:03:37 2014 +0200 @@ -7,13 +7,16 @@ /* this refers to the event time defined as a global variable in the main program */ extern double utc; +/* main panel id */ +extern unsigned int MainPanel; -int __logger_init(struct logger *l) +int __logger_init(struct logger *l, void(*onerror)(int, const char *)) { int rv, panel; char path[MAX_PATHNAME_LEN], *filename; + l->onerror = onerror; l->fd = -1; panel = LoadPanel(0, "FXAnalyse.uir", LOGGING); @@ -78,6 +81,10 @@ /* display message */ SetCtrlVal(l->panel, LOGGING_LOGGING, msg); + /* report error */ + if (level == ERROR) + l->onerror(level, msg); + /* write to log file */ if (l->fd >= 0) write(l->fd, msg, len);