summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-09-24 07:50:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-09-24 07:50:25 -0400
commitf7e159775d3d854d2fe512287fdb02c072bedcb4 (patch)
tree83538da976050443ff5b4cca73dafb477b8f5c2a /coverage
parent44049333cb1c2550fe5a5e9d54d57c5c3589ee3b (diff)
downloadpython-coveragepy-f7e159775d3d854d2fe512287fdb02c072bedcb4.tar.gz
Don't print a call stack for each line in multi-line debug output
Diffstat (limited to 'coverage')
-rw-r--r--coverage/debug.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/coverage/debug.py b/coverage/debug.py
index 96e5792..823d2b2 100644
--- a/coverage/debug.py
+++ b/coverage/debug.py
@@ -37,8 +37,14 @@ class DebugControl(object):
"""Decide whether to output debug information in category `option`."""
return (option in self.options or option in FORCED_DEBUG)
- def write(self, msg):
- """Write a line of debug output."""
+ def write(self, msg, callers=True):
+ """Write a line of debug output.
+
+ `msg` is the line to write. A newline will be appended. If `callers`
+ is true, and the user has requested it, the call stack will be written
+ also.
+
+ """
if self.should('pid'):
msg = "pid %5d: %s" % (os.getpid(), msg)
self.output.write(msg+"\n")
@@ -50,7 +56,7 @@ class DebugControl(object):
"""Write a sequence of (label,data) pairs nicely."""
self.write(info_header(header))
for line in info_formatter(info):
- self.write(" %s" % line)
+ self.write(" %s" % line, callers=False)
def info_header(label):