adding check if logger is in debug mode to avoid string concatenation of the whole response object which might get quite large.

At the moment object concatenation is done always although it's only required in debug mode