SQL logging

First implementation of sql logging, everything should be both awesome and amazing.