Click here to Skip to main content
Click here to Skip to main content

JavaScript Debugger and Tracer Tool

By , 16 Mar 2007
 

Introduction

JavaScript Tracer Tool simply covers the the function of alert(); but I took it one step forward and added some other functions to make it more useful. This application gives you the opportunity of continuously debugging and seeing each and every steps of your application, without even adding any irrelevant code to your own application.

Using the code

Tracer is a very useful application. To make it work you only have to call the trace.js file. It will run by itself.

<script type="text/javascript" src="trace.js"></script>

Here is a list of functions Tracer has. Just give them the particular elements.

  • trace(): in your application you just use it as trace("hello world");, instead of alert("Hello World");. Tracer will print the result with numbering and coloring. trace() also has another format to use, trace("arg1","arg2","arg3"). In this option you just give the values as arguments and it will number them and print in order. This is useful for printing a function's arguments.
  • traceArr(): this function displays the each element of an array with their positions.
  • traceAssoc(): This function is for associative arrays. If you give this function an array it will show you the key and the value of each array element.
  • traceStr(): This function is almost the same as traceArr() but it works for strings, and shows you the each character of a string with numbers.
  • traceError()This function is for custom error messages. very suitable for Try, Catch blocks.
  • RunJS tab: is for Running the JavaScript codes realtime on the page.
  • Watch: When you write the ID of an Object in text box, watch follows that element's content and prompts on screen. It's quite useful for hidden elements and automatically changing values. Watch can catch more than one Element.
  • Tracer also catches the runtime errors and displays them with the file name and line numbers. This feature is really useful for IE users. Error handling is optional, you can stop handling in settings tab.
  • Also, the whole Tracer body is floating, that means you can move it where you want. Tracer can remember last position, last state, last tab and last setting by using cookies.

You can find more helpful information on the Online Demo page.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

About the Author

serkanyersen
Web Developer
Turkey Turkey
Member
Hi, My name is Serkan Yerşen, I'm 24 years old and I'm from TURKEY,
I recently graduated from The Computer Technologies and Programming department of Bilkent University, Bilkent is the one of the many biggest Universities in TURKEY.
I worked for my school for a year. After i quit job at my school. i started to work on web apllication developments.
Currently I'm Working for The Jotform Development Team in Interlogy LLC Company.
 

My proficiencies are VB6, PHP, MySQL, JavaScript and AJAX technics, CSS+HTML, and Linux Systems.
 
You can find more information about me by visiting my blogs.
My English Blog
My Turkish Blog

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralNice one!memberSandeep Mewara24 Mar '10 - 5:07 
Thumbs Up | :thumbsup:
QuestionWhy re-invent the wheel?membervolkan.ozcelik21 Mar '07 - 6:54 
Serkan,
 
Don't get me wrong.
It's an excellent tool and I like it.
 
I re-empasize that I never ever intend to criticise you but cannot find a better way to rephrase my thoughts:
 
I wonder the practical purpose of such a tool.
I mean, why should I use it given that I can do much more with firebug?
(preferably combined with developer toolbar to enhance its functionality)
 
Is this project just for personal/academical interest?
 
Best,
 

 

AnswerRe: Why re-invent the wheel?memberserkanyersen21 Mar '07 - 10:57 
Hi Volkan,
You are very right about your each and every thoughts, if I were you, I would write the same things about it.
However, You misunderstood the purpose of this application, my real purpose to write this application was way more different than you think.
first thing, I know about the firebug and webdeveloper toolbar they are great tools and I'm using them, but they are not available in IE and also Error handling of IE is terrible as you know I wrote it to use mostly In IE bug fixes and development process.
While I was developing my current project I really needed this kind of a tool. And I wrote one for my self.
It had to be cross browser and should easily be applied in every application and should not keep application from working on another browsers.
The thing is I wrote it for myself, and I wanted to share it. who knows it may be useful for someone else, I thought.
 
This tool was born to fulfill a needing, not to "invent wheel again".
 
eventually,
I didn't get you wrong, I just wanted to share an application which I find cool Smile | :)
Thanks...
AnswerThanksmembervolkan.ozcelik21 Mar '07 - 22:52 
Thank you Sinan for your explanation.
 
Actually, at times I like re-inventing stuff as well.
It enables you to understand the subject thoroughly.
 
Ideally javascript has ought to work identically in FF and in IE given that you write code that complies with DOM standards. But in practice "client requirements" may drag you to some weird points where the front end is cross-browser but the admin gui only works in IE (yes I've done projects like that before Smile | :) And it's a real pain in the you-know-where)
 
Yes the goal of developer is to educate the client. But education only works if client is "willing" to learn.
 
Will be looking forward to new add-ons and enhancements to your project.
 
Best,
 

News[Off-topic] ... A favormembervolkan.ozcelik21 Mar '07 - 22:57 
Unrelated to the discussion;
 
Your Turkish blog will be meme'd tonight.
 
Cheers.
 

AnswerRe: [Off-topic] ... A favormemberserkanyersen25 Mar '07 - 4:32 
Thanks for supporting the blog, as a pay back, I've Wrote a post Smile | :) Thanks again.
AnswerRe: Why re-invent the wheel?memberRick Fencl7 Sep '07 - 9:43 
Firebug is not the be all and end all. I've had situations where Firebug stops working, I need to get something specific to IE to work, etc. This tool is exactly what I was looking for thanks.
 
Rick
GeneralNew Versionmemberserkanyersen8 Nov '07 - 3:29 
Thanks Rick.
I'm working on the new version if you liked this one you gonna love new version Big Grin | :-D .
It will be much faster because I'm using more dom scripting. I changed the way I save properties so there won't be a lot of cookies.
Whole tracer will be written as an object so there wont be any conflict with your own code.
 
New window of the tracer will be re sizable this gives you more flexibility.
Watch property will be changed completely. instead of writing ids you are going to choose elements from a list.
 
If you have any ideas please let me know.
GeneralPlease leave a suggestionmemberserkanyersen24 Jan '07 - 22:02 
I really want to develop this application. if you have any suggestions, or critics I'm open for them please leave a message.
 

GeneralRe: Please leave a suggestionmembertsdragon30 Jan '07 - 3:23 
A couple of suggestions I can think of right off the bat:
 
1. The ability to specify more than one watch id. Perhaps a list of ids, separated by semicolons.
 
2. The ability to execute a trace command dynamically. I.E a text box where you can enter a trace command.
 
3. The ability to execute any javascript statement. I.E. a text box where you can enter a javascript statement and have it eval'ed in the context of the page. (This would also take care of #2 above.)
 
Nice program! I'm going to add it to my current project right now.
 
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.

GeneralRe: Please leave a suggestion [modified]memberserkanyersen30 Jan '07 - 6:43 
tsdragon,
thank you for your suggestions.
I thought about the the first suggestion but I couldn't be able to do it. multiple watch is possible but I thought it would be too complicated to use. however, I'll reconsider to add that feature, it seemed more logical when you mentioned about it.
the other suggestions you left were out of my knowledge, but i recently learned how to make it possible, so they will be ready in the next version.
thank you again I hope it will be useful.
 

-- modified at 16:25 Tuesday 30th January, 2007

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 16 Mar 2007
Article Copyright 2007 by serkanyersen
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid