title: Testing stdout logger with PyTest
body: <p>I would like to test my logger in PyTest. My logger is currently setup to log to stdout.</p>
  
  <p>My question is how do I capture the logs to stdout within PyTest? For example on initialisation my logger prints the following:</p>
  
  <pre><code>{"logger_level": "error", "event": "logging_initialised", "logger": "log.logger", "level": "info"}
  </code></pre>
  
  <p>How could I check that the levels within the json are correct and it has indeed printed this?</p>
  
  <p>Thanks for help!</p>