diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
commit | 252cf9315ee1cdabab7b35bf8e868e7ac73b0429 (patch) | |
tree | 69fb14ce3567e8448fca312969de0480fde762c8 /coverage/debug.py | |
parent | 321e1921ca02a3dc3507eb095efd38efe6c79ba9 (diff) | |
download | python-coveragepy-git-252cf9315ee1cdabab7b35bf8e868e7ac73b0429.tar.gz |
Don't print a call stack for each line in multi-line debug output
Diffstat (limited to 'coverage/debug.py')
-rw-r--r-- | coverage/debug.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index 96e57920..823d2b22 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): |