Added debug logging which can be enabled my client option on initialisation