Make console logging function configurable.

Split log() into 2 methods: formatArgs() and log(), allowing log to be
overridden on a per-namespace or global level. Global log settings trump
per-namespace settings.