title: Print Nashorn engine debug to a txt file
body: <p>I'm developing a functionality that lets the user execute custom scripts with Nashorn, one of the requirements is that the users can see a report(debug) of how the function was executed.</p>
  
  <p>something like: </p>
  
  <pre><code>var a = context.valueA;
  var b = context.valueB;
  return a+b;
  </code></pre>
  
  <p>would print something like:</p>
  
  <pre><code>var a = 15;
  var b = 10;
  return 15+10; == 25
  </code></pre>
  
  <p>Does someone know a good way to do that? Or access the Nashorn debugger programmatically and get details of the execution?</p>