title: How to write console.log to a file instead
body: <p>Now I show the information using:</p>
  <pre><code>console.log (kraken.id, markets)
  </code></pre>
  <p>However, I want to write all the information that goes to the console to a file instead. How can that be done by completing the below code?</p>
  <pre><code>'use strict';
  var ccxt = require('ccxt');
  
  (async () =&gt; {
    let kraken = new ccxt.kraken()
    let markets = await kraken.load_markets()
    //console.log (kraken.id, markets)
  
  
    //How to write above console.log to file?
    const fs = require('fs');
    fs.writeFile(&quot;/Users/Andreas/Desktop/NODE/myproject/files/test.txt&quot;, &quot;allinfoAsstring&quot;, function (err) {
      if (err) {
        return console.log(err);
      }
  
      console.log(&quot;The file was saved!&quot;);
    });
  })()
  </code></pre>