             if err
                 perr = new Error "Ad request returned error: #{err}"
                 @stream.log.error perr, error:err
-                debug perr
+                pdebug perr
                 return detach perr
 
             if res.statusCode == 200
                 new Preroller.AdObject body, (err,obj) =>
                     if err
-                        @stream.log.debug "Ad request was unsuccessful: #{err}"
+                        perr = "Ad request was unsuccessful: #{err}"
+                        @stream.log.debug perr
+                        pdebug perr
                         return detach err
 
                     if obj.creativeURL
                         # we need to take the creative URL and pass it off
                         # to the transcoder
-                        debug "Preparing transcoder request for #{obj.creativeURL} with key #{@streamKey}."
+                        pdebug "Preparing transcoder request for #{obj.creativeURL} with key #{@streamKey}."
 
                         treq = request.get(@transcode_uri, qs:{ uri:obj.creativeURL, key:@streamKey })
                             .once "response", (resp) =>
-                                debug "Transcoder response received: #{resp.statusCode}"
+                                pdebug "Transcoder response received: #{resp.statusCode}"
 
                                 if resp.statusCode == 200
                                     treq.pipe(writer,end:false)
                                     treq.once "end", =>
-                                        debug "Transcoder pipe complete."
+                                        pdebug "Transcoder pipe complete."
 
                                         # we return by giving a function that should be called when the
                                         # impression criteria have been met

            else
                perr = new Error "Ad request returned non-200 response: #{body}"
                @stream.log.debug perr
                return detach perr

        detach = (err,impcb) =>
            clearTimeout(prerollTimeout) if prerollTimeout
            socket.removeListener "close", conn_pre_abort
            socket.removeListener "end", conn_pre_abort

            .replace("!UA!", encodeURIComponent(client.ua))
            .replace("!UUID!", client.session_id)

        pdebug "Ad request URI is #{uri}"

        # -- make a request to the ad server -- #

