An open window into your running nodejs code.
This module creates a very convenient REPL session served through the telnet protocol.
function mycode(var1, var2, var3) {
require('zenpoint')({
listen: 1976,
inspectDepth: 0,
persist: false,
context: {
var1,
var2,
var3,
},
});
// ... do some unrelated work here
return 42;
}
mycode('zenpoint', 'the debugging helper', 'for zen fellas');
$ telnet localhost 1976
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ππ§π Welcome to the Zenpoint π₯π¦π¦
πππππ¦β mycode (repl:2:17)
πππππ¦β repl:1:1
πππππ¦β ContextifyScript.Script.runInThisContext (vm.js:50:33)
πππππ¦β REPLServer.defaultEval (repl.js:240:29)
πππππ¦β bound (domain.js:301:14)
πππππ¦β REPLServer.runBound [as eval] (domain.js:314:12)
πππππ¦β REPLServer.onLine (repl.js:468:10)
πππππ¦β emitOne (events.js:121:20)
βββ«zenuser@zenhost:~/src/zenpoint#[email protected]βπππβ£β
β>β«this
{ console: [Getter],
global: [Circular],
process: [Object],
Buffer: [Object],
clearImmediate: [Function],
clearInterval: [Function],
clearTimeout: [Function],
setImmediate: [Object],
setInterval: [Function],
setTimeout: [Object],
module: [Object],
require: [Object],
mycode: [Function: mycode],
d: [Function],
inspectOptions: [Object],
log: [Function],
cr: [Function: cr],
stack: 'πππππ¦β mycode (repl:2:17)\r\nπππππ¦β repl:1:1\r\nπππππ¦β ContextifyScript.Script.runInThisContext (vm.js:50:33)\r\nπππππ¦β REPLServer.defaultEval (repl.js:240:29)\r\nπππππ¦β bound (domain.js:301:14)\r\nπππππ¦β REPLServer.runBound [as eval] (domain.js:314:12)\r\nπππππ¦β REPLServer.onLine (repl.js:468:10)\r\nπππππ¦β emitOne (events.js:121:20)\r\nπππππ¦β REPLServer.emit (events.js:211:7)',
var1: 'zenpoint',
var2: 'the debugging helper',
var3: 'for zen fellas',
frozen: [Object] }
βββ«zenuser@zenhost:~/src/zenpoint#[email protected]βπππβ£β
β>β«
console.log cannot be used because its output goes right to the process' stdout. Instead use the log() function
log('this is this', this);
The depth of the inspection usd by log() can be tuned with the d() function
d(4);
The state of the context is frozen at the initialization of the server and
can be accessed through the frozen
object.
log('frozen state', frozen);
log('current state', {var1, var2, var3});