[Bps-public-commit] storage-box branch, truncate-really-large-downloads, created. 0c3340b9234a4a3131f73ed8edcf8d2f51858b21

Dave Goehrig dave at bestpractical.com
Mon Sep 26 14:38:43 EDT 2016


The branch, truncate-really-large-downloads has been created
        at  0c3340b9234a4a3131f73ed8edcf8d2f51858b21 (commit)

- Log -----------------------------------------------------------------
commit 0c3340b9234a4a3131f73ed8edcf8d2f51858b21
Author: Dave Goehrig <dave at bestpractical.com>
Date:   Mon Sep 26 14:37:22 2016 -0400

    turncate large downloads in logs
    
    when debug mode is turned on the response is logged
    in order to prevent the log from filling up with many
    MB of large files, it will be truncated to 1k when
    logging.  this should be enough to debug most issues

diff --git a/lib/Storage/Box/Request.pm b/lib/Storage/Box/Request.pm
index a76950a..7ec6ab3 100644
--- a/lib/Storage/Box/Request.pm
+++ b/lib/Storage/Box/Request.pm
@@ -98,7 +98,7 @@ sub request {
     $self->code($self->curl->getinfo(CURLINFO_RESPONSE_CODE));
     $logger->info("Request to " . $self->url . " returned status  " . $self->code . "\n");
     $self->body($body);
-    $logger->debug("Response: " . $self->body . "\n");
+    $logger->debug("Response: " . substr($self->body,0,1024) .  ( length($self->body) > 1024 ? " (truncated)\n" : "\n"));
     $self;
 }
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list