summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-03-13 17:12:42 +0100
committerDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-03-13 17:12:42 +0100
commitf21700e00e81538d5510973a51b8ae97fb4a24dd (patch)
treed1dcd07f2a29243e279fe2915c5db7814e99ea13 /src
parente4614cf09b90cc9a0e38d370bb090a11f3877b33 (diff)
downloadastra-f21700e00e81538d5510973a51b8ae97fb4a24dd.tar.gz
astra-f21700e00e81538d5510973a51b8ae97fb4a24dd.tar.bz2
astra-f21700e00e81538d5510973a51b8ae97fb4a24dd.tar.xz
astra-f21700e00e81538d5510973a51b8ae97fb4a24dd.zip
Enable logging to Matlab window using callback function
Also introduces a mex initialize function that is called at the first invocation of any mex method.
Diffstat (limited to 'src')
-rw-r--r--src/Logging.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Logging.cpp b/src/Logging.cpp
index 9011d37..9d7c219 100644
--- a/src/Logging.cpp
+++ b/src/Logging.cpp
@@ -124,8 +124,7 @@ void CLogger::_setLevel(int id, log_level m_eLevel)
void CLogger::setOutputScreen(int fd, log_level m_eLevel)
{
_assureIsInitialized();
- clog_free(0);
- clog_init_fd(0, fd);
+ clog_set_fd(0, fd);
_setLevel(0,m_eLevel);
}
@@ -169,6 +168,11 @@ CLogger::CLogger()
;
}
+bool CLogger::setCallbackScreen(void (*cb)(const char *msg, size_t len)){
+ _assureIsInitialized();
+ return clog_set_cb(0,cb)==0;
+}
+
bool CLogger::m_bEnabledScreen = true;
bool CLogger::m_bEnabledFile = true;
bool CLogger::m_bFileProvided = false;