Logging

The Duktape distributable includes a logging framework 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.

Basic usage example:

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);

The example would print something like the following to stderr:

2014-10-17T19:26:42.141Z INF test.js: three values: foo 123 1973-11-29 23:33:09.000+02:00

See the Wiki article How to use logging and logging.rst for more details.