For those of us who maintain the presumably nasty debugging habit of littering JavaScript source code with console.log statements:

  1. Include clog.js
  2. use clog (message, criteria) where you'd normally use console.log (message)
  3. browse to the page you're debugging with a clog query key (e.g.: ?clog) whose value matches your desired criteria (e.g.: http://example.com/index.html?clog=criteria) to log messages with matching criteria to the console

That's it! Use ?clog=* to log all messages to the console.

The following examples can be found in this page's source code. Try the following links with the console open:

function functionName () {
	clog ("This message appears in the console if ?clog=A or ?clog=*", "A");
};

clog ("This message only appears in the console if ?clog=*");

functionName ();