13#include <Poco/Message.h>
14#include <boost/python/import.hpp>
20constexpr int PY_CRITICAL = 50;
21constexpr int PY_ERROR = 40;
22constexpr int PY_WARNING = 30;
23constexpr int PY_INFO = 20;
24constexpr int PY_DEBUG = 10;
25constexpr int PY_NOTSET = 0;
27auto pythonLevel(
const Message::Priority prio) {
29 case Message::Priority::PRIO_FATAL:
30 case Message::Priority::PRIO_CRITICAL:
32 case Message::Priority::PRIO_ERROR:
34 case Message::Priority::PRIO_WARNING:
36 case Message::Priority::PRIO_NOTICE:
37 case Message::Priority::PRIO_INFORMATION:
39 case Message::Priority::PRIO_DEBUG:
40 case Message::Priority::PRIO_TRACE:
51 auto logger = (boost::python::import(
"logging").attr(
"getLogger")(
"Mantid"));
52 m_pyLogger = std::make_unique<boost::python::object>(std::move(logger));
58 if (Py_IsInitialized()) {
74 const auto numericLevel = pythonLevel(msg.getPriority());
75 logFn(numericLevel, msg.getText());
Defines a structure for acquiring/releasing the Python GIL using the RAII pattern.
std::unique_ptr< boost::python::object > m_pyLogger
~PythonLoggingChannel() override
void log(const Poco::Message &msg) override