| 19 | }; // dummy class |
| 20 | |
| 21 | std::pair<std::string, int> GetPythonCallFrame() { |
| 22 | const auto frame = py::module_::import("sys").attr("_getframe")(0); |
| 23 | const std::string file = py::str(frame.attr("f_code").attr("co_filename")); |
| 24 | const std::string function = py::str(frame.attr("f_code").attr("co_name")); |
| 25 | const int line = py::int_(frame.attr("f_lineno")); |
| 26 | return std::make_pair(file + ":" + function, line); |
| 27 | } |
| 28 | |
| 29 | void BindLogging(py::module& m) { |
| 30 | py::classh<Logging> PyLogging(m, "logging", py::module_local()); |