title: Nightwatch pipe all console messages to a file
body: <p>I'm using nightwatch to run some QA tests on code I have little control over. The app consists of multiple windows being opened through the use of popups. Because it is difficult to know exactly when to try and grab the console within my tests, I'd like a way of piping all console messages from any window that is running within the context of selenium, to an output file so I can sift through it.</p>
  
  <p>Right now I have this in my test</p>
  
  <pre><code>.getLog('browser', function (result) {
      console.log(typeof result)
          fs.writeFile("browser.log", JSON.stringify(result), function(err) {
              if(err) {
                  return console.log(err);
              }
              console.log("Log Saved");
      });
  });
  </code></pre>
  
  <p>This may work for some cases, but sometimes the code I am hoping to catch happens on an unload event. In a situation like that, catching the error at the correct time proves challenging. I was hoping that nightwatch might expose some sort of event listener api where I could observe the browser.log file for example, and update the contents of the file automatically. Does such a feature exist? Is there a better way to do this?</p>