Make log truncation configurable
diff --git a/mitmproxy/proxy/layer.py b/mitmproxy/proxy/layer.py
index 275125a3f8..27328c4fc7 100644
--- a/mitmproxy/proxy/layer.py
+++ b/mitmproxy/proxy/layer.py
@@ -27,6 +27,10 @@
 """
 
 
+MAX_LOG_STATEMENT_SIZE = 512
+"""Maximum size of individual log statements before they will be truncated."""
+
+
 class Paused(NamedTuple):
     """
     State of a layer that's paused because it is waiting for a command reply.
@@ -97,8 +101,8 @@ def __repr__(self):
 
     def __debug(self, message):
         """yield a Log command indicating what message is passing through this layer."""
-        if len(message) > 512:
-            message = message[:512] + "…"
+        if len(message) > MAX_LOG_STATEMENT_SIZE:
+            message = message[:MAX_LOG_STATEMENT_SIZE] + "…"
         if Layer.__last_debug_message == message:
             message = message.split("\n", 1)[0].strip()
             if len(message) > 256:

Provide addons with the means to disable log truncation. We're in a pretty hot path here, so we'll keep this as a constant instead of a full-blown mitmproxy option.

/cc @erikshestopal