added possibility of logging stats to DataBase (instead of logging to file)