Unfortunately console.log(foo) calls foo.toString() if and only if the console is open, and there is no way to disable this in Chrome or Firefox.
Edit: You can redefine console.log to be a noop, but that's also detectable.
Edit: You can redefine console.log to be a noop, but that's also detectable.
foo.toString = () => console.warn("called")
console.log(foo)