From d830b8d5f2740a46aed2956c253c94d9e21c6db7 Mon Sep 17 00:00:00 2001 From: Lior Ramati Date: Sun, 5 Apr 2020 14:23:44 +0300 Subject: [PATCH] [python] log_to_callback --- wrappers/python/python.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wrappers/python/python.cpp b/wrappers/python/python.cpp index ba4b35f265..ad92616aae 100644 --- a/wrappers/python/python.cpp +++ b/wrappers/python/python.cpp @@ -40,6 +40,21 @@ PYBIND11_MODULE(NAME, m) { /** rs.hpp **/ m.def("log_to_console", &rs2::log_to_console, "min_severity"_a); m.def("log_to_file", &rs2::log_to_file, "min_severity"_a, "file_path"_a); + + py::class_ log_message(m, "log_message"); + log_message.def("line_number", &rs2::log_message::line_number) + .def("filename", &rs2::log_message::filename) + .def("raw", &rs2::log_message::raw) + .def("full", &rs2::log_message::full) + .def("__str__", &rs2::log_message::raw) + .def("__repr__", &rs2::log_message::full); + + m.def("log_to_callback", [](rs2_log_severity min_severity, std::function callback) + { + rs2::log_to_callback(min_severity, callback); + }, "min_severity"_a, "callback"_a); + m.def("log", &rs2::log, "severity"_a, "message"_a); + // rs2::log? /** end rs.hpp **/ }