add logs to database

Things can now be logged to the database with the dblog() function.