Python logging handler to append to list
<p>Somewhat similar to this (unanswered) question here:</p>

<p><a href="https://stackoverflow.com/questions/33136398/python-logging-handler-that-appends-messages-to-a-list">https://stackoverflow.com/questions/33136398/python-logging-handler-that-appends-messages-to-a-list</a></p>

<p>I am looking to use a handler to simply append anything (passing a filter) to a python list. I would envisage some kind of code like this:</p>

<pre><code>import logging
import sys
mylog = logging.getLogger()
mylog.setLevel(logging.DEBUG)

log_list = []
lh = logging.SomeHandler(log_list)
lh.setLevel(logging.DEBUG)

mylog.addHandler(lh)
mylog.warning('argh')
print log_list[0]
</code></pre>

<p>The question is therefore - how can I implement this? What <code>SomeHandler</code> can I use? </p>