Added partial logging

Added table log to db. Added enum combining loglevel and errorcode.