Rewrite the logging mechanism, add support for new EntityTypes