Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22559

Re: Eye for bugs

From Tim Streater <timstreater@greenbee.net>
Newsgroups comp.lang.javascript
Subject Re: Eye for bugs
Date 2014-01-10 23:09 +0000
Message-ID <100120142309312235%timstreater@greenbee.net> (permalink)
References <06555351-b90c-4a99-8e22-169eebbc1522@googlegroups.com> <lapl2a$m9k$1@dont-email.me>

Show all headers | View raw


In article <lapl2a$m9k$1@dont-email.me>, Michael F. Stemper
<michael.stemper@gmail.com> wrote:

> On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:
> > I find it very hard to spot logical errors when dealing with Writing out to
> > Canvas, normally i write out values from JavaScript with document.write()
> > line by line in the HTML document as i step thru loops but using the canvas
> > you just plot over values without implementing plotout logic?
> >
> > Have anyone a good idea?
> 
> O'Reilly does.
> 
> You can create a window for trace messages, using this technique
> (straight from the Javascript Rhino book).
> 
> 
> First, place something like this early on in your code (possibly in
> the head element):
> 
> var trace_win = null;
> function trace( message )
> {
>    // if necessary, open trace window
>    if( (trace_win==null) || trace_win.closed )
>    {
>      trace_win = window.open( "trace" );
>      trace_win.document.open( "text/plain" );
>    }
> 
>    trace_win.document.writeln( message );
> }
> 
> 
> Then, you can scatter calls to "trace" throughout your script, just as
> you would calls to "alert". The difference is that you don't need to
> acknowledge each individual one, and you have a transcript of the
> entire program's execution:
> 
>     trace( "Changing color to: " + line_col );
>     trace( "Entering fuction foobar" );
>     trace( "Finished with foobar" );
>     trace( "Drawing from (" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 
> ")" );
>     trace( "snarf is currently: " + snarf );
> 
> and so on.

why not just use console.info() ?? You get all this for free.

-- 
"The idea that Bill Gates has appeared like a knight in shining armour to
 lead all customers out of a mire of technological chaos neatly ignores 
 the fact that it was he who, by peddling second-rate technology, led them
 into it in the first place."                             - Douglas Adams

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Eye for bugs jonas.thornvall@gmail.com - 2014-01-06 01:56 -0800
  Re: Eye for bugs jonas.thornvall@gmail.com - 2014-01-08 01:48 -0800
    Re: Eye for bugs jonas.thornvall@gmail.com - 2014-01-10 06:48 -0800
      Re: Eye for bugs Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-10 16:20 +0100
  Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 14:26 -0600
    Re: Eye for bugs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-10 22:12 +0100
      Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 18:15 -0600
        Re: Eye for bugs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-11 15:53 +0100
    Re: Eye for bugs Tim Streater <timstreater@greenbee.net> - 2014-01-10 23:09 +0000
      Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 18:17 -0600

csiph-web