title: How to capture everything that is printed in a jupyter notebook based on ipython?
body: <p>Inside a jupyter notebook based on ipython I have a function that prints something. I can not change this function as it is from a library. Let's take</p>
  
  <pre><code>def print_something():
      print("something")
  </code></pre>
  
  <p>as an example. When I run <code>print_something()</code> in a cell, I want to save whatever the cell is printing in a file. How do I do that? I tried <code>%save</code> and <code>%logstart</code>, but as <code>print</code> is not creating an output, they don't do what I want.</p>