[tor-commits] [stem/master] Nicer logging when receiving controller data

atagar at torproject.org atagar at torproject.org
Wed Nov 23 18:06:36 UTC 2011


commit 1c2337a71f9f19e262cd222679bf66eb046a9e73
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Nov 23 06:47:11 2011 -0800

    Nicer logging when receiving controller data
    
    Changing the logged controller messages a bit. This is a bit less faithful to
    the raw controller response but it's more readable.
---
 stem/types.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/stem/types.py b/stem/types.py
index 4415598..882ca99 100644
--- a/stem/types.py
+++ b/stem/types.py
@@ -124,7 +124,9 @@ def read_message(control_file):
       # end of the message, return the message
       parsed_content.append((status_code, divider, content))
       
-      LOGGER.debug("Received message:\n" + raw_content)
+      # replacing the \r\n newline endings and the ending newline since it
+      # leads to more readable log messages
+      LOGGER.debug("Received message:\n" + raw_content.replace("\r\n", "\n").rstrip())
       
       return ControlMessage(parsed_content, raw_content)
     elif divider == "+":





More information about the tor-commits mailing list