Add MySQL logging, checks for failing and encapsulated in a method