Search code examples
vtkpyvista

Is it possible to silent native VTK logs when using python wrapper and/or pyvista?


Currently, we are using Python's vtk wrapper and also Pyvista (a more pythonist vtk wrapper).

At some parts of the process we have some log lines from .cxx files:

2022-03-17 17:21:56.031 ( 156.058s) [        4CC78740]      vtkDelaunay3D.cxx:518   WARN| vtkDelaunay3D (0x559d2b180400): 1 degenerate triangles encountered, mesh quality suspect
2022-03-17 17:21:58.045 ( 158.072s) [        4CC78740]            vtkMath.cxx:522   WARN| Unable to factor linear system
2022-03-17 17:21:58.288 ( 158.314s) [        4CC78740]      vtkDelaunay3D.cxx:518   WARN| vtkDelaunay3D (0x559d0877c080): 3 degenerate triangles encountered, mesh quality suspect

Is it possible to suppress or to manage those logs from python logging module?


Solution

  • you have the vtkLogger class to manage your logs (I know, c++ docs but VTK has a lack of python doc).

    e.g.:

    vtk.vtkLogger.SetStderrVerbosity(vtk.vtkLogger.VERBOSITY_OFF)