title: Disable or Catch VTK warnings in vtkOutputWindow when embedding Mayavi
body: <p>I'd like to either disable the VTK warning window or, better yet, catch them to handle with my application's logging system.  My application is using an embedded mayavi view, and I don't want error windows popping up that I have no control over.  The following code demonstrates the warning window.</p>
  
  <pre><code>import numpy as np
  from mayavi import mlab
  
  x1 = np.array([1, 1, 2, 3])
  y1 = np.array([1, 1, 4, 2])
  z1 = np.array([1, 1, 5, 1])
  
  mlab.plot3d(x1, y1, z1)
  
  mlab.show()
  </code></pre>
  
  <p>Ok, I've done some research and discovered that <code>vtk.vtkObject.GlobalWarningDisplayOff()</code> will disable the window completely, which is nice.  Better yet the followingcode  will log the warnings to a file (found it <a href="http://nullege.com/codes/show/src@b@i@bioimagexd-HEAD@mayavi@trunk@vtkPipeline@test_parser.py/130/vtkpython.vtkFileOutputWindow" rel="noreferrer">here</a>):</p>
  
  <pre><code>def redirect_vtk_messages ():
      """ Can be used to redirect VTK related error messages to a
      file."""
      import tempfile
      tempfile.template = 'vtk-err'
      f = tempfile.mktemp('.log')
      log = vtkpython.vtkFileOutputWindow()
      log.SetFlush(1)
      log.SetFileName(f)
      log.SetInstance(log)
  </code></pre>
  
  <p>So while this is nice, I'm still unable to pipe the warnings directly into a logging handler.  I'd rather not have to have a vtk_log file next to my regular log files.  Also I might want to handle the warnings in my GUI somehow, or give the user options on how to handle them and constantly watching a log file for changes seems like a poor way to do that.</p>
  
  <p>Any suggestions on a robust pythonic way to handle vtk warnings in an application which embeds mayavi/vtk?</p>