Skip to content
jsguy edited this page Sep 10, 2011 · 2 revisions

What is it?

tagsole is an expansion of the traditional JavaScript console concept, to allow tagging in console operations, and providing a complete history and filtering plus simple globbing functionality. This can be useful for troubleshooting, or creating unit tests in medium to large JavaScript applications, by giving you more control over what is logged, and how you interact with the data.

Note: This does not override the console, it is a completely separate function; it does have the ability to call the console, and is compatible with most implementations; see the API section for details.

How to use it

TODO: Simple example: using the "history" method

How can I write a unit test with this?

TODO: Example with a JS application that loads ajax, log before, success, error and show simple integration with both live code (for troubleshooting live issues) and mocked responses.

Name-spacing

TODO: Show how to effectively use globbing on name-spaced example code

Event system

You can subscribe to several events within tagsole; simply use the addEventListener method. tagsole.addEventListener("EVENT_NAME", function(...){...});

Subscribable events

  • output - catches anything that would go to the console, eg: log, warn, etc...
    • function(out), out is an object with the log
    • Example

` tagsole.addEventListener("output", function(out){ console.log("Added tag:", tag); }); '

  • addtag - fires when a new tag is encountered, useful for outputting the order of tags, or sniffing when your code reaches a specific tag
    • function(tag, out), tag is a string with the new tag, and out is the output passed to it

TODO:

API

FAQ