Logging/DB to class libs, expanded events query

DB mostly working now