Two small issues with this:
* `console.log()' will already mention the application name in the origin;
* the return value should be consistent, but `dump()' returns `true' and `console.log()' doesn’t return anything.

So if you want to be able to default to `console.log()', I’d suggest something like this (untested):
```javascript
  function dump_on(msg, optionalObject) {
    if (optionalObject) {
      msg += JSON.stringify(optionalObject);
    }
    if (dump) {
      var appName = document.location.hostname.replace(/\..*$/, '');
      dump('[' + appName + '] ' + msg);
    } else {
      console.log(msg);
    }
  }
```