lbenc135 commented on a change in pull request #7713:
URL: https://github.com/apache/pulsar/pull/7713#discussion_r599459545
##########
File path: pulsar-client-cpp/python/src/config.cc
##########
@@ -88,6 +88,107 @@ static ProducerConfiguration&
ProducerConfiguration_setCryptoKeyReader(ProducerC
return conf;
}
+class LoggerWrapper: public Logger {
+ std::string _logger;
+ PyObject* _pyLogger;
+ int _currentPythonLogLevel = _getLogLevelValue(Logger::LEVEL_INFO);
+
+ void _updateCurrentPythonLogLevel() {
+ PyGILState_STATE state = PyGILState_Ensure();
+
+ try {
+ _currentPythonLogLevel = py::call_method<int>(_pyLogger,
"getEffectiveLevel");
+ } catch (py::error_already_set e) {
+ PyErr_Print();
+ }
+
+ PyGILState_Release(state);
+ };
+
+ int _getLogLevelValue(Level level) {
+ return 10 + (level * 10);
+ }
+
+ public:
+
+ LoggerWrapper(const std::string &logger, PyObject* pyLogger) :
_logger(logger) {
+ _pyLogger = pyLogger;
+ Py_XINCREF(_pyLogger);
+
+ _updateCurrentPythonLogLevel();
+ }
+
+ LoggerWrapper(const LoggerWrapper& other) {
+ _pyLogger = other._pyLogger;
+ Py_XINCREF(_pyLogger);
+ }
+
+ LoggerWrapper& operator=(const LoggerWrapper& other) {
Review comment:
You were right, it was unused. Removed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]