Logging infrastructure

Extracted all the manual console.log calls, emitting events for them now. Also built infrastructure to hook up loggers easily at store creation time, and a sample console logger implementation.

Part of implementation of #13