Questions about debug()

I was happy to finally get the debug() method with Programmaticon V. I’m not a programmer, so it took some time to find my way with Chrome’s debug console and to realize that my debug messages would appear under Info.

So, I started with something simple:

friends = self.findFriends()
# then somewhere later
self.debug(friends)

This filled up the logs in no time, with error-like messages, and obviously hit the limit of 200 lines:

see console log output
|Theia's Cheryl| Generated random seed 5037662241 of type submissionCount from sessionIDs 55817697ded9c48605474f0f submissionCount 1
Angel.coffee:55 |Theia's Cheryl|   Loaded 44 of 1350 (+1041ms)
Angel.coffee:55 |Theia's Cheryl|   Loaded 88 of 1350 (+1033ms)
Angel.coffee:55 |Theia's Cheryl|   Loaded 155 of 1350 (+1070ms)
3Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl|   Loaded 242 of 1350 (+1069ms)
3Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl|   Loaded 327 of 1350 (+1008ms)
Angel.coffee:55 |Theia's Cheryl|   Loaded 415 of 1350 (+1049ms)
3Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl|   Loaded 494 of 1350 (+1013ms)
Angel.coffee:55 |Theia's Cheryl|   Loaded 608 of 1350 (+1117ms)
60Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl|   Loaded 647 of 1350 (+1055ms)
102Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl|   Loaded 681 of 1350 (+1028ms)
17Angel.coffee:55 |Theia's Cheryl| Could not post log: Gorgin,Scott,Mirana,Brian,Antary DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned. Error: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': An object could not be cloned.
    at Error (native)
    at Object.console.log (https://codecombat.com/javascripts/workers/worker_world.js:51:14)
    at t.Programmable.debug (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:343:24)
    at Object.e.exports.createAPIClone.r [as debug] (https://codecombat.com/javascripts/aether.js:2507:13)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:2000:106)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.next (https://codecombat.com/javascripts/aether.js:31:7)
    at t.eval (eval at <anonymous> (https://codecombat.com/javascripts/aether.js:2531:7), <anonymous>:7625:38)
    at e.Symbol (https://codecombat.com/javascripts/aether.js:36:224)
    at Object.<anonymous> (https://codecombat.com/javascripts/aether.js:31:7)
    at Object.e.exports.e.sandboxGenerator.e.next (https://codecombat.com/javascripts/aether.js:2319:44)
    at Object.e.exports.wrapWithSandbox.b [as next] (https://codecombat.com/javascripts/aether.js:2533:19)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:94:36)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at t.Plans.endCurrentPlan (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:121:17)
    at t.Plans.chooseAction (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:85:21)
    at t.e.exports.t.callChainedMethod (https://codecombat.com/javascripts/world.js:225:191)
    at t.r [as chooseAction] (https://codecombat.com/javascripts/lodash.js:50:27)
    at Action.update (eval at <anonymous> (https://codecombat.com/javascripts/world.js:333:20), <anonymous>:41:19)
    at t.e.exports.t.getNextFrame (https://codecombat.com/javascripts/world.js:395:100)
    at World.module.exports.World.getFrame (https://codecombat.com/javascripts/world.js:297:52)
    at World.module.exports.World.loadFrames (https://codecombat.com/javascripts/world.js:306:10)
    at https://codecombat.com/javascripts/world.js:303:172 undefined
Angel.coffee:55 |Theia's Cheryl| Log limit 200 reached; shutting up.

Is it a bug or a feature?

This is why I didn’t want to put in debug, because it’s totally janky: it goes to your JS console, isn’t very performant, and can’t easily serialize many types of objects across the web worker boundary. So if you end up seeing a problem like this, try to just debug a simpler type of value, like len(friends) or friends[0].id or something.

Later we will have a better debugging method.

Thanks, will experiment a bit more with it today.