summaryrefslogtreecommitdiffstats
path: root/src/uscxml/interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/interpreter')
-rw-r--r--src/uscxml/interpreter/BasicContentExecutor.cpp6
-rw-r--r--src/uscxml/interpreter/ContentExecutorImpl.h2
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp2
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.h7
-rw-r--r--src/uscxml/interpreter/Logging.h6
-rw-r--r--src/uscxml/interpreter/MicroStepImpl.h1
6 files changed, 18 insertions, 6 deletions
diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp
index 376561d..60a45e5 100644
--- a/src/uscxml/interpreter/BasicContentExecutor.cpp
+++ b/src/uscxml/interpreter/BasicContentExecutor.cpp
@@ -144,7 +144,7 @@ void BasicContentExecutor::processSend(XERCESC_NS::DOMElement* element) {
} else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds
delayMs = strTo<uint32_t>(delayAttr.value);
} else {
- LOG(USCXML_ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'";
+ LOG(_callbacks->getLogger(), USCXML_ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'";
}
}
} catch (Event e) {
@@ -355,14 +355,14 @@ void BasicContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPr
} else if (iequals(tagName, xmlPrefix.str() + "script")) {
processScript(block);
} else {
- LOG(USCXML_ERROR) << tagName;
+ LOG(_callbacks->getLogger(), USCXML_ERROR) << tagName;
assert(false);
}
} catch (ErrorEvent exc) {
Event e(exc);
_callbacks->enqueueInternal(e);
- LOG(USCXML_ERROR) << exc << std::endl;
+ LOG(_callbacks->getLogger(), USCXML_ERROR) << exc << std::endl;
USCXML_MONITOR_CALLBACK1(_callbacks->getMonitors(), afterExecutingContent, block);
throw e; // will be catched in microstepper
diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h
index 7eaebbc..dfd4c5f 100644
--- a/src/uscxml/interpreter/ContentExecutorImpl.h
+++ b/src/uscxml/interpreter/ContentExecutorImpl.h
@@ -24,6 +24,7 @@
#include "uscxml/Common.h"
#include "uscxml/messages/Event.h"
#include "uscxml/interpreter/InterpreterMonitor.h"
+#include "uscxml/interpreter/Logging.h"
#include <string>
#include <set>
@@ -73,6 +74,7 @@ public:
/** Monitoring */
virtual std::set<InterpreterMonitor*> getMonitors() = 0;
virtual Interpreter getInterpreter() = 0;
+ virtual Logger getLogger() = 0;
};
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
index 85c77a8..43059bf 100644
--- a/src/uscxml/interpreter/InterpreterImpl.cpp
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -249,7 +249,7 @@ bool InterpreterImpl::isTrue(const std::string& expr) {
} catch (ErrorEvent e) {
// test 244: deliver error execution
- LOG(USCXML_ERROR) << e;
+ LOG(getLogger(), USCXML_ERROR) << e;
// test 344
enqueueInternal(e);
diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h
index ade2a91..f4fe93e 100644
--- a/src/uscxml/interpreter/InterpreterImpl.h
+++ b/src/uscxml/interpreter/InterpreterImpl.h
@@ -225,6 +225,8 @@ public:
/** --- */
void setActionLanguage(const ActionLanguage& al) {
+ if (al.logger) // we intialized _logger as the default logger already
+ _logger = al.logger;
_execContent = al.execContent;
_microStepper = al.microStepper;
_dataModel = al.dataModel;
@@ -237,6 +239,10 @@ public:
_factory = factory;
}
+ virtual Logger getLogger() {
+ return _logger;
+ }
+
static std::map<std::string, std::weak_ptr<InterpreterImpl> > getInstances();
virtual XERCESC_NS::DOMDocument* getDocument() {
@@ -281,6 +287,7 @@ protected:
MicroStep _microStepper;
DataModel _dataModel;
ContentExecutor _execContent;
+ Logger _logger = Logger::getDefault();
InterpreterState _state;
diff --git a/src/uscxml/interpreter/Logging.h b/src/uscxml/interpreter/Logging.h
index dd59e95..7221d5b 100644
--- a/src/uscxml/interpreter/Logging.h
+++ b/src/uscxml/interpreter/Logging.h
@@ -28,8 +28,10 @@
#include <memory>
-#define LOG(lvl) uscxml::Logger::getDefault().log(lvl)
-#define LOG2(lvl, thing) uscxml::Logger::getDefault().log(lvl, thing);
+#define LOG(logger, lvl) logger.log(lvl)
+#define LOG2(logger, lvl, thing) logger.log(lvl, thing)
+#define LOGD(lvl) uscxml::Logger::getDefault().log(lvl)
+#define LOGD2(lvl, thing) uscxml::Logger::getDefault().log(lvl, thing);
namespace uscxml {
diff --git a/src/uscxml/interpreter/MicroStepImpl.h b/src/uscxml/interpreter/MicroStepImpl.h
index cdb98f2..1544e78 100644
--- a/src/uscxml/interpreter/MicroStepImpl.h
+++ b/src/uscxml/interpreter/MicroStepImpl.h
@@ -59,6 +59,7 @@ public:
/** Monitoring */
virtual std::set<InterpreterMonitor*> getMonitors() = 0;
virtual Interpreter getInterpreter() = 0;
+ virtual Logger getLogger() = 0;
};
/**