The goals for our new approach were:
- Enable print debugging in browsers with no console.
- Stupid simple to understand with no dependencies. We don’t want to have to debug the debugger. We just want it to work.
There is definitely room for improvement in this script. For example, though it would introduce a dependency, it wouldn’t be too much work to add stack trace support using Stacktrace.js.
console.log everywhere isn’t the most elegant form of debugging, but it was all that was available to us. We originally thought of this as a last resort for debugging, but ended up reaching for this little bit of code many times to solve tough problems.