You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
1004 B

<h1 id="logging">Logging</h1>
<p>The Duktape distributable includes a
<a href="https://github.com/svaarala/duktape/tree/master/extras/logging">logging framework</a>
with a small footprint, reasonable performance, and redirectable output. The framework
was a built-in in Duktape 1.x but was moved into an optional extra in Duktape 2.x.</p>
<p>Basic usage example:</p>
<pre class="ecmascript-code">
var val1 = 'foo';
var val2 = 123;
var val3 = new Date(123456789e3);
var logger = new Duktape.Logger(); // or new Duktape.Logger('logger name')
logger.info('three values:', val1, val2, val3);
</pre>
<p>The example would print something like the following to <code>stderr</code>:</p>
<pre>
2014-10-17T19:26:42.141Z INF test.js: three values: foo 123 1973-11-29 23:33:09.000+02:00
</pre>
<p>See the Wiki article
<a href="http://wiki.duktape.org/HowtoLogging.html">How to use logging</a> and
<a href="https://github.com/svaarala/duktape/blob/master/doc/logging.rst">logging.rst</a>
for more details.</p>