Make logging easier to read.

 * Shift common logging code to it's own module.
 * Add timestamp+module+severity to log messages.