title: How to get a list of warnings from sphinx compilation
body: <p>I am developing a sphinx based collaborative writing tool. Users access the web application (developed in python/Flask) to write a book in sphinx and compile it to pdf.</p>
  
  <p>I have learned that in order to compile a sphinx documentation from within python I should use</p>
  
  <pre><code>import sphinx
  result = sphinx.build_main(['-c', 'path/to/conf',
                              'path/to/source/', 'path/to/out'])
  </code></pre>
  
  <p>So far so good.</p>
  
  <p>Now my users want the app to show them their syntax mistakes. But the output (<code>result</code> in the example above) only gives me the exit code.</p>
  
  <p>So, how do I get a list of warnings from the build process?</p>
  
  <p>Perhaps I am being too ambitious, but since sphinx is a python tool, I was expecting to have a nice pythonic interface with the tool. For example, the output of <code>sphinx.build_main</code> could be a very rich object with warnings, line numbers...</p>
  
  <p>On a related note, the argument to the method <code>sphinx.build_main</code> looks just like a wrapper to the command line interface.</p>