Use db for logging. This is not finished yet.