Skip to content

Redirect SOFA logs to Python's sys.stdout using a custom PythonMessageHandler#576

Open
alxbilger wants to merge 1 commit intosofa-framework:masterfrom
alxbilger:pythonmessagehandler
Open

Redirect SOFA logs to Python's sys.stdout using a custom PythonMessageHandler#576
alxbilger wants to merge 1 commit intosofa-framework:masterfrom
alxbilger:pythonmessagehandler

Conversation

@alxbilger
Copy link
Contributor

SOFA log messages were not displayed in a Jupyter notebook. The reason is explained here. pybind11 has a way to redirect std::cout/std::cerr to Python's sys.stdout: https://pybind11.readthedocs.io/en/stable/advanced/pycpp/utilities.html

Note that SofaRuntime.init() must be called in order to enable this redirection.

Result in a notebook:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant