bgarrels / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

JavaScript debugging (e.g. trace_add() equivalent for JS) #312

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On the PHP side, Textpattern offers that very useful function 'trace_add'. This 
function allows adding log notes to your code, and since 'trace_add' respects 
the site's production status, those lines can be left in the production code.

For JavaScript there is no normalized debugging tool to speak of, which makes 
debugging of JavaScript more time consuming and harder than PHP. Giving 
JavaScript same type of 'trace' functionality could be very much beneficial.

This would potentially include:

- Feeding JS the site's production status (textpattern.production_status).
- Introducing a 'textpattern.Trace.add()' method.

Original issue reported on code.google.com by jukka.m.svahn on 7 Nov 2012 at 4:00

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r4590.

Original comment by jukka.m.svahn on 7 Nov 2012 at 11:15

GoogleCodeExporter commented 9 years ago
"textpattern.Console.log('bar');" outputs two lines:

> bar
> undefined

I wonder whether textpattern.Console.log() should return something useful, e.g. 
"this" so one could for instance easily drill into textpattern.Console.history  
from the JS console.

Original comment by r.wetzlmayr on 10 Nov 2012 at 2:07

GoogleCodeExporter commented 9 years ago
Sorry, I can't replicate double message issue. In which web browser?

Running 'textpattern.Console.log' should print a single instance to the 
console. Before r4657 It didn't print anything else to anywhere else or return 
anything.

I'm not sure what you mean by returning the instance. What .log() returns, 
doesn't affect Console API directly. Neither you can directly feed it it's own 
instance since it would just cause recursion error.

Returning 'this' could be a good idea considering chaining.

Original comment by jukka.svahn@rahinaa.biz on 10 Nov 2012 at 2:31

GoogleCodeExporter commented 9 years ago
Ugh, multi-account login.

Original comment by jukka.m.svahn on 10 Nov 2012 at 2:34

GoogleCodeExporter commented 9 years ago
I didn't intend to use "for instance" as a reference to any JS object but as an 
English phrase meaning "for example" ;)

r4657 is all I wanted to suggest.

Original comment by r.wetzlmayr on 10 Nov 2012 at 2:39