You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a custom python LogWriter object is set and dropped, the next logging output will lead to a RuntimeError: Tried to call pure virtual function "ifm3d::LogWriter::write" error. To ensure the logging works as expected the custom python LogWriter instance needs to be kept alive for the whole Lifetime of the program.
To Reproduce
# Define a custom LogWriterclassMyLogWriter(LogWriter):
defwrite(self, entry: LogEntry) ->None:
print("Logging from python: ", LogFormatterText.format(entry))
if__name__=="__main__":
# The python instance will be dropped after the set_writer method returns leading to a RuntimeError on the next logging callLogger.set_writer(MyLogWriter())
Workaround
Ensure the python LogWriter instance stays valid for the whole runtime of the application:
# Define a custom LogWriterclassMyLogWriter(LogWriter):
defwrite(self, entry: LogEntry) ->None:
print("Logging from python: ", LogFormatterText.format(entry))
# Create a global MyLogWriter instanceMY_LOGGER=MyLogWriter()
if__name__=="__main__":
# Assign the LogWriter instanceLogger.set_writer(MY_LOGGER)
The text was updated successfully, but these errors were encountered:
Describe the bug
If a custom python LogWriter object is set and dropped, the next logging output will lead to a
RuntimeError: Tried to call pure virtual function "ifm3d::LogWriter::write"
error. To ensure the logging works as expected the custom python LogWriter instance needs to be kept alive for the whole Lifetime of the program.To Reproduce
Workaround
Ensure the python LogWriter instance stays valid for the whole runtime of the application:
The text was updated successfully, but these errors were encountered: