Duktape has a built-in logging framework with a small footprint, reasonable performance, and redirectable output.
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 stdout
:
2014-10-17T19:26:42.141Z INF test.js: three values: foo 123 1973-11-29 23:33:09.000+02:00
See logging.rst for more info.